* gitコマンド [#f8757267] #setlinebreak(on); #contents ** ベアリポジトリの作成 [#m0cfa55b] #html(<div style="padding-left:20px;">) *** initコマンドでベアリポジトリを作成 [#f0dae236] #myterm2(){{ git init --bare --shared /path_to/sample.git }} *** リモートリポジトリからcloneしてベアリポジトリを作成 [#e83c2ff2] #myterm2(){{ git clone --bare ./sample /path_to/sample.git }} &br; #html(</div>) ** リモートリポジトリからclone [#g0d693e7] #myterm2(){{ git clone /path_to/sample.git }} ** リモートリポジトリからリモート追跡ブランチにfetch [#x0f4104f] #myterm2(){{ git fetch /path_to/sample.git }} ** リモート追跡ブランチからローカルリポジトリに merge [#ce60c621] #myterm2(){{ git merge origin/master }} ** リモートリポジトリから pull [#cd2f8e26] #myterm2(){{ git pull origin master }} ** リモートリポジトリにpush [#o7e78c78] #myterm2(){{ git push origin master }} ** リモートリポジトリの確認 [#gd8100d4] #myterm2(){{ git remote -v }} ** リモートリポジトリを追加する [#gd8100d4] #myterm2(){{ git remote add remote2 /path_to_/sample.git }} ※remote2という名前(ラベル)で追加 #html(<div style="padding-left:20px;">) *** リモートリポジトリを指定してpush [#u7b6dbdd] #myterm2(){{ git push remote2 branch1 }} *** リモートリポジトリを指定してpull [#pd2bbbac] #myterm2(){{ git pull remote2 master }} #html(</div>) ** ローカルリポジトリに add [#i6310ac6] #myterm2(){{ git add --all }} ** ローカルリポジトリに commit [#aef66818] #myterm2(){{ git commit -m "comment" }} ** ローカルリポジトリのブランチ一覧を確認する [#k5f5a2e8] #myterm2(){{ git branch または git branch -v }} ** 追跡リポジトリのブランチ一覧を確認する [#u7acb30c] #myterm2(){{ git branch -r }} ** ブランチを切り替え [#v7144d72] #myterm2(){{ git checkout branch1 }} ** rebaseを使用してローカルブランチに リモート master をマージする [#d99eeca1] #myterm2(){{ # ローカルmaster を最新にする git checkout master git pull origin master # ブランチに切り替えてrebase git checkout branch1 git rebase master # コンフリクトがある場合は ファイルを修正&addしてから以下を繰り返し git rebase master --continue }}