I've recently moved from svn to git, and I'm now wondering how I can generate a list of commits sorted by the date they are pushed to the repository.
Let's say you have cloned origin/master at a given date, with this list you would know exactly which commit you have pulled.
I've read many threads (like this, or this, even this) explaining git parenting system. At some point, I thought I could use git log
together with the -m --first-parent
option.
However looking at our existing merges, the first parent seems to be mixed up many times (ie. we have foxtrot merges), making it impossible to follow origin/master.
Now I'm wondering: is my request even possible?
I've seen that Team Foundation Server / VSTS displays a list of pushes that is exactly what I want. Merges will show the messages from corresponding commits.
They even have an API for that. However, I'd like to avoid relying on them to generate my push-list.
VSTS logs additional meta-data on the server side. This meta-data is not available in your local repository. In addition to standard Git-commit-data, it logs:
This information is not available in your local git repository. Looking at it from a distributed version control position, it's also a bit strange to rely on this meta-data, because it could have been pushed to many different repositories at many different times. And it may have been pushed from one repository to another.
Only in a blessed repository setup (which role the TFS/VSTS server is performing in your setup), can that server keep track of what was pushed to that server.
Hence, you'll need to rely on the REST API provided by TFS/VSTS.
What should I do about the pre-existing foxtrot merges that have infected my git repo? Nothing. Leave them. Unless you’re one of those antisocial people that rewrites master. Then go nuts. Actually, please don’t.
But if you're really inclined to untangling:
I accidentally created a foxtrot merge, but I haven’t pushed it. How can I fix it? You have three possible remedies:
- Simple rebase:
- Reverse your earlier merge to make origin/master the first-parent:
- Create a 2nd merge commit after the foxtrot merge to preserve origin/master’s –first-parent relation.
But please don’t do #3, because the final result is called a “Portuguese man o’ war merge,” and those guys are even worse than foxtrot merges.
Source: https://developer.atlassian.com/blog/2016/04/stop-foxtrots-now/