Hacker News new | past | comments | ask | show | jobs | submit login

What does "I don't think it means what you think it means" refer to?



Reverting a merge commit is the big danger zone.

Let's say you are working on a feature branch and you accidentally commit it to the upstream branch before you're ready. Intuitively, you might then revert the merge changeset, continue working on your feature branch for a while, and then when you're done, merge it back upstream.

That would be wrong.

What will actually happen is that when you do the second merge, only the changes you made after the reverted merge will be applied to the upstream branch. All the work that was "reverted" in the initial mistaken merge will be missing, even after the second merge! This can be very confusing, since there's no indication to the developer where it went. It's just gone.

The fix at that point it to revert the revert changeset. But the real solution is to never revert a merge.


Possibly that `git revert` doesn't somehow remove the commit you've done, rather it creates a new commit removing the changes, along with a commit message saying which commit is being reverted.


I don't think it's specifically about reverting merge commits but rather the fact that "git revert" is quite different from "svn revert" which may not be immediately clear and may not meet everyone's understanding of the term "revert" - which is to say, it does not simply "get rid of" the unwanted commit but rather creates a new one that has the net effect of undoing that commit's changes.


I keep meaning to make an alias for it called "git anticommit".


As well as what my sibling comments said, it is also a reference to The Princess Bride.

Would you like to know more? http://knowyourmeme.com/memes/you-keep-using-that-word-i-do-...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: