#author("2018-07-26T00:50:59+09:00","default:Miyashita","Miyashita")
#author("2018-08-24T14:35:54+09:00","default:Miyashita","Miyashita")
*ブランチに関する設定 [#vf0e3a64]
***ブランチを確認する [#dc48d807]
#codeprettify{{
git branch -a
}}
により,ローカルにあるブランチとリモートリポジトリの追跡ブランチを表示する.~
以下のように表示される.*が付いているものがローカルで現在属しているブランチ名.
   another_branch
 * master
   remotes/origin/HEAD -> origin/master
   remotes/origin/another_branch
   remotes/origin/master
リモートリポジトリが更新されている場合は,
#codeprettify{{
git fetch origin
}}
の後に実行しないと最新の表示とはならない.

***新規にブランチを作成する [#p6ff1741]
ブランチを作成するには,以下の1文を入力する.
#codeprettify{{
git branch newbranch
}}
この場合,作成されるのみで,現在のものが移動するわけではない.~

***ブランチを変更する [#s4c22938]
既存のブランチに入るには,以下の1文を入力する.
#codeprettify{{
git checkout newbranch
}}

***現在のブランチを抜け,新しいブランチに変更する [#na453f92]
上記2つのブランチ新規作成と変更を一度に行いたい場合は,下記のように1行にまとめることができる.
#codeprettify{{
git checkout -b newbranch
}}

***ローカルで作成したブランチをリモートリポジトリへ送信 [#f3f387e7]
ローカルで新しく作成した後,単なる git push だけでは,新しいブランチの情報は反映されない.
#codeprettify{{
git push origin newbranch
}}

***ローカルブランチの削除 [#le629361]
devブランチを削除したい場合
#codeprettify{{
git branch -d dev
}}

***リモートブランチの削除 [#b18f9ea3]
リモートリポジトリのブランチを削除する場合は,branchコマンドではなく,pushになる.
#codeprettify{{
git push origin :dev
}}
または
#codeprettify{{
git push --delete origin dev
}}


Front page   Edit Diff Attach Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes