4 ms·
This is excellent: opinionated and correct. Guess what happens if you try to git revert a merge? Yeah. Don’t do that. You can, but you really need to understa
by js2 12y ago
This is excellent: opinionated and correct.
Guess what happens if you try to git revert a merge? Yeah. Don’t do that.
You can, but you really need to understand what happens when you do so, so that you're not confused by future merges from the same branch. Straight from the horse's mouth:
https://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt https://www.kernel.org/pub/software/scm/git/docs/howto/rever...
- bellerocky 12y agoReverting a merge is totally OK if you kept your history clean and rebased the branch you're merging into to get updates instead of merging it into your branch. Like if you created a new branch from master and you have been merging master into your branch to get updates in master, once you merge your branch into master you cannot revert this merge because the act of merging master into your branch changed which branch owned commits. If you rebased master into your branch instead everything will be fine. If you merge your branch into master, reverting that merge will simply undo the merge as you expected.
- deleted 12y ago[deleted]
- michaelmior 12y agoWhile I agree this guide is great, I think opinionated and correct are mutually exclusive.
- chrisweekly 12y ago"...opinionated and correct are mutually exclusive." TIMTOWTDI.
- michaelmior 12y agoVery true, but whenever that is the case, there are typically some who decide their way is the "right" way for various reasons.
- pjungwir 12y agoI've read that doc and other warnings about reverting a merge. But I've found that if you revert the revert, then you avoid the problems they mention. I guess the worry is that you still have to remember to do that, or you'll have commits that silently never merge. But if you do remember, then reverting the revert makes things okay. But I'm no expert. Can anyone else confirm this for me?
- bobthecow 12y agoYes, the correct way to do it is to revert the revert. js2's link above outlines how and why in detail.