0

This might be a duplicate, I just didn't happen to find one.

Basically the scenario is: there were some minor changes to a file in some commit, and now the file has been modified even more (to add new features, etc.).

What I would like to do is to automatically undo (if possible) the changes to the file in that commit, without actually going back to an old revision of the file; i.e., whatever the diff for that commit was, the reverse of it should be applied to the current version. The result is a new "fixed" version of the latest file.

I realize it isn't always possible for a computer to do this, but when the future changes after the bad commit are completely unrelated and in a different location, it should be possible. How can I do this?

1 Answer 1

4

find out the commitish you want to undo and revert it:

$ git revert 53ab103e8f 

will revert commit 53ab103e8f (by creating a new entry in your repository, that explicitely reverts that change; if there are problems with reverting, you will be asked to manually resolve the conflict)

Sign up to request clarification or add additional context in comments.

1 Comment

+1 D'oh, I didn't know that's what revert does, haha. I thought it goes back to that commit. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.