$ git branch         # リポジトリ内のすべてのローカルブランチを表示
$ git checkout test  # 作業ディレクトリをブランチ "test" に切り替え
$ git branch new     # 現在の HEAD から始まる "new" ブランチを作成
$ git branch -d new  # "new" ブランチの削除
現在の HEAD (デフォルト)以外の場所から始まるブランチを作成するには、次のようにします:
$ git branch new test    # "test" ブランチのHEADから開始するブランチ "new" を作成
$ git branch new v2.6.15 # タグ v2.6.15 から開始するブランチ "new" を作成
$ git branch new HEAD^   # 最新のコミットの1つ前の位置から分岐するブランチを作成
$ git branch new HEAD^^  # 最新のコミットの2つ前の位置から分岐するブランチを作成
$ git branch new test~10 # ブランチ "test" の10個前の位置から分岐するブランチを作成
新しいブランチの作成と切り替えを同時に行うには:
$ git checkout -b new v2.6.15
複製(clone)元のリポジトリのブランチを更新しテストするには:
$ git fetch             # 更新
$ git branch -r         # リモートブランチの一覧を表示
  origin/master
  origin/next
  ...
$ git checkout -b masterwork origin/master
他のリポジトリ上にあるブランチを取得(fetch)し、 そのブランチに対して名前を付けるには:
$ git fetch git://example.com/project.git theirbranch:mybranch
$ git fetch git://example.com/project.git v2.6.15:mybranch
リポジトリの一覧を管理し、定期的にそこから変更を取得するには:
$ git remote add example git://example.com/project.git
$ git remote                    # リモートリポジトリの一覧を表示
example
origin
$ git remote show example       # 詳細を表示
* remote example
  URL: git://example.com/project.git
  Tracked remote branches
    master
    next
    ...
$ git fetch example             # example のブランチを更新
$ git branch -r                 # すべてのリモートブランチの一覧を表示