Three Git branch options you might not know
Hey there! I’m Srebalaji. You are receiving this email because you have subscribed to level up your game in Git.
List all branches that are already merged into a particular branch
git branch --merged <respective_branch_name>
Example
git branch --merged master
The above command will help you find all branches already merged with the master branch.
List branches containing a particular commit hash
git branch --contains <commit-hash>
Example
git branch --contains f9456ba
The above command will list all branches containing a provided commit hash.
Show all commits in the current branch yet to be merged to the parent
git cherry -v <parent_branch>
Example
git cherry -v master
The above command will list all commits in the current branch yet to be merged to the respective branch.
That’s it for today.
See you next week :)