Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home Blog Reversion Control

Reversion Control

Posted by Manuel Reinhardt at Nov 03, 2014 04:50 PM |

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.

reinhardt
reinhardt says:
Nov 07, 2014 09:21 PM

The "revert the revert" method is supported by this howto:

https://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt

Commenting has been disabled.