A git commit can have an arbitrary number of parents. This can be the case, for example, when you use git merge
to merge more than one commit into your current branch.
You can, for example, use the git cat-file -p <commit-hash>
command to take a peek into the commit object. It will show you all the parents associated with the commit (along with some other information). It will produce an output like the following:
tree 6418daa1541f090b7ab144f09b79d93bb9a60218 parent 81c948a6488fc505be7eb22575a15e2db65c5d32 parent bdb425d2e0f76f30991f9c92c33fdfb9b09918ff author John Doe <[email protected]> 1639416517 +0100 committer John Doe <[email protected]> 1639416517 +0100 Related commit message is shown here
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.