技術めも

git入門

precomit 無効

--no-verify

git入門

http://dotinstall.com/lessons/basic_git

1. 作業ディレクトリ
2. ステージングエリア(インデックス)
3. リポジトリ(ローカル、リモート)

git config --global user.name "NAME"
git config --global user.email "E-MAIL"
git config --global color.ui true
git config -l
git config --help
git help config

git init
git add       ステージングエリアに保存
git commit
git log

git log --oneline
git log -p
git log --stat

git status
git checkout -- index.html

git diff
git diff --cached

git add .
git rm / git mv

.gitignore

git commit -m "(message)"
git commit --amend     amend:変更する

git reset --hard HEAD          commit前のコマンド
git reset --hard HEAD^         ^ ハッド(その前)
git reset --hard ID最低7桁         ^ ハッド(その前)
   * --hard 作業ディレクトリ、ステージングエリア 両方

git reset --hard ORIG_HEAD         ORIG_HEAD 前回取り消された情報が1つ入っている

git branch                      一覧表示
git branch (branch name)
git checkout (branch name)      ブランチ間移動

git merge (branch name)          [masterで] git marge test
git branch -d (branch name)        いらないブランチを削除

git checkout -b (branch name)      ブランチを作って&チェックアウト

コンフリクト
vim index.html
git add .
git commit -m "conflict fix"

git tag
git tag (tag name)                 直近のコミットにタグをつける
git show (tag name)                内容表示
git tag (tag name) (commit id)
git tag -d (tag name)

エイリアス
git config --global alias.co checkout
git config --global alias.st status
git config --global alias.br branch
git config --global alias.ci commit
git config -l

共有レポジトリ hoge.git

Aさん myweb
Bさん myweb2

git init --bare    共有レポジトリを作る(ここではcommitできない)

git remote add origin (repos location)      共有レポジトリ追加
git remote rm hogehoge
git push origin master          origin(共有レポジトリ)に向かって master の内容送信

git clone [PATH] myweb2
git push origin master
git pull origin master

git commit -am "Message"

git pull/push
コンフリクトの解決

git push origin master でエラー
→ git pull origin master
コンフリクト

Gitでよく使う21コマンドまとめ
http://web-k.github.io/blog/2012/11/08/git/



git fetch origin
git diff origin/master

git fetch origin
git show-branch --all --color