I want to get the parent name of the current branch.
for example: I have the following graph:
If I change my current branch to A
(git checkout A
) I want to get the name of the paranet branch (master
)
And if I change my current branch to B
(git checkout B
) I want to get the name of the paranet branch (A
)
I looked here:
How to find the nearest parent of a Git branch? but it didn't give me the results I want:
git log --graph --decorate
gives me:
git branch -a
A
* B
master
remotes/origin/A
remotes/origin/master
git log --graph --decorate
commit e3a6137ad7697faf74bfffb784249ffbd061f9e8 (HEAD -> B, origin/A, A)
...
commit 8c4564d8800aebc0d374449f4040a7ae0dfabf9c (origin/master, master)
or:
git checkout A
git log --graph --decorate
commit e3a6137ad7697faf74bfffb784249ffbd061f9e8 (HEAD -> A, origin/A, B)
commit 8c4564d8800aebc0d374449f4040a7ae0dfabf9c (origin/master, master)
moreover there is no command git parent
so how can I get the name of the parent branch ?