I went through couple of blogs to understand a merge commit, but not completely clear as to what it is and what is the best practice to avoid it. And the tree diagram of the git log added further confusion to my understanding of merge commits. Help?
A merge commit is just like another commit, the state of your repository at a given point in time plus the history it evolved from.
The one thing special about a merge commit is that it has at least two predecessors, therefor a plain vanilla diff doesn't make sense, you can only compare the merge with one of the predecessor, which yields the changes from the other parent(s)
To avoid merge commits, you can rebase your changes before pushing them to a remote repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With