現在のブランチの親ブランチを調べる
$ git branch # (1) 現在のブランチを確認
br02
$ git show-branch | grep '*' # (2) git show-branchを実行
* [br02] 修正
* [br02] 修正
+*+ [br01~2] ブランチ作成
++*+ [master~2^2~2] コミット忘れ
++*+ [master~2^2~3] 画面まわり修正
- (1)で現在のブランチを確認する。ここではbr02とする。
- (2)でgit show-branchを実行して、全ブランチとコミットの一覧を表示する。
- その際、先頭付近に*がある行が現在のブランチに関係するコミットなので、grepで抽出する。
- 後は遡ってブランチ名を確認する。
- ここではbr02の親ブランチはbr01だと分かる。
参考
- https://git-scm.com/docs/git-show-branch