ブランチの操作

ブランチを作ったり合わせたり

ブランチを作る

$ git branch <branchname>

ブランチを確認する

ローカルブランチの一覧を表示する

$ git branch

リモートブランチの一覧を表示する

$ git branch --remote
$ git branch -r

ローカルブランチとリモートブランチの一覧を表示する

$ git branch --all
$ git branch -a

指定したブランチにマージ済みのブランチを確認する

$ git branch --merged <branchname>

マージしていないブランチを表示する

$ git branch --no-merged

コミットハッシュとコミットメッセージを表示する

$ git branch --verbose
$ git branch -v

ブランチを切り替える

$ git checkout <branchname>

masterブランチに切り替える

$ git checkout master

ブランチを作って切り替える

$ git checkout -b <branchname>

ブランチをマージする

指定したブランチをマージする

$ git merge <branchname>

masterに指定ブランチをマージする

$ git checkout master
$ git merge <branchname>

ブランチを削除する

指定したローカルブランチを削除する

$ git branch --delete <BRANCH NAME>
$ git branch -d <BRANCH NAME>

指定したリモートブランチを削除する

$ git push --delete origin <branchname>

See Also

ファイルの移動

ファイルの移動と名前変更

git clone

Gitリポジトリの複製

git config

gitのパラメータを設定する

基本操作

init, add, remote, commit, reset, rm

git remoteの使い方

リモートリポジトリを編集する