How to check which branch is the parent branch
of the current branch
in git, is it possible to check that?
Asked
Active
Viewed 1,985 times
0

Bennison J
- 414
- 1
- 12
1 Answers
4
To see the parent directly above your branch run
git show-branch \
| sed "s/].*//" \
| grep "\*" \
| grep -v "$(git rev-parse --abbrev-ref HEAD)" \
| head -n1 \
| sed "s/^.*\[//"
git show-branch
works to see the structure as well. Every indent is a branch above.

Brandon Kauffman
- 1,515
- 1
- 7
- 33