git how to check branch parent code example
Example 1: find the parent branch of a git branch
git log --first-parent
Example 2: find out a branch a parent branch git
git show-branch -a | grep '\*' | grep -v `git rev-parse --abbrev-ref HEAD` | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'
Example 3: how to check current branch in git
git rev-parse --abbrev-ref HEAD
// To check the current branch
Example 4: how to get parent branch updates in my branch git
git merge A