Question

I'm tracking a svn repository using git. A merge was done on 2014-01-09 (producing commit A) and another on 2014-02-12 (producing commit B). When I git checkout master; git log, I see the commits for the merges, but I also see, for instance, a commit on 2014-02-04 (C) made against a branch (which was merged as part of B).

Why would a commit made against a branch show up when running git log on trunk ?

I discovered this while trying to rewind my master and branches to a particular date in time to try to execute merge B again to see what conflicts exist. I had assumed that I could git checkout master; git reset --hard B^; git merge branch;, but that didn't work, then I saw these extra commits from branches in my trunk log and got confused.

Any help you can offer on the subject will be much appreciated!

Was it helpful?

Solution

If C is part of a branch that was merged into master to produce B, then a git log on master will include all commits that were in the branch, including C. This is expected behavior, and necessary to understand all the individual commits that are a part of master. There may be a flag to git log to hide commits that also appear in different branch, but I can't find such a mechanism.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top