目次

git branch

git branch : ブランチ情報の表示およびブランチの作成

http://sourceforge.jp/magazine/09/03/16/0831212/4

github で取り出したプロジェクトのブランチを作る例:

github に ssh key 登録済みとする。

$ git clone git@github.com:nishimotz/facesynthesizer.git
$ cd facesynthesizer
$ git branch mac
$ git branch
  mac
* master
$ git checkout mac
$ git branch
* mac
  master

mac でコンパイルが通るように直した、とする。

$ git commit -m "message" -a
$ git push origin mac

ブランチが github にできている。

https://github.com/nishimotz/facesynthesizer/tree/mac

終わったら master にマージしたい。以下、別のプロジェクトでの例。

$ git checkout master

$ git merge mac
Updating ac82b15..4b233c1
Fast-forward
 Makefile     |   14 +-
 configure    | 4608 +++++++++++++++++++++-------------------------------------
 configure.in |    8 +
 do_output.c  |   12 +-
 4 files changed, 1673 insertions(+), 2969 deletions(-)

確認する。

$ git log

mac ブランチへのコミットがまるごと master ブランチへのコミットになっている。

commit 4b233c1f48fb1086c5fd996997ff866526e064cb
Author: Takuya Nishimoto <nishimotz@gmail.com>
Date:   Sat Nov 13 15:58:34 2010 +0900

    enable-macosx option (audio device is not supported)

github レポジトリにこれを戻す:

$ git push origin master

いらなくなったブランチを消す:

$ git branch -d mac

サードパーティの追跡

since 2011-10-16

本家 1.00 の修正版を作ったら、本家が 1.01 を出した。差分をマージしたいが、自分が行った重要な変更は捨てたくない。