Coding, Scripting, Administration

Reversion Control

Assuming you're using git for version control, let's say you've merged a feature branch into the master branch of some repository. Then you decide that the feature is not quite ready yet after all, and you revert the merge. Later on, after a few more modifications, you merge the feature branch into master again. You could think that now you have all the changes from the feature branch in master. But that's probably not correct. The man page for git revert says:

"Reverting a merge commit declares that you will never want the tree changes brought in by the merge. As a result, later merges will only bring in tree changes introduced by commits that are not ancestors of the previously reverted merge. This may or may not be what you want."

(Git 1.9.1 03/19/2014 GIT-REVERT(1))

In a situation like this I was able to bring back the changes by reverting the revert commit - no guarantees for this, though, as I'm not yet aware of any recommendation or best practice for this.

EDIT: The “revert the revert” method is supported by this howto:

9th November 2014Filed under: git