I’ve read the similar posts on this topic, and can’t for the life of me figure out how to do this properly.

I checked in about 1000 files that I don’t want, and I’d rather not have to go through 1by1 and remove them all from the repo.

  • I have a remote master Branch.
  • I have the local master Branch.

They are both at the same revision.

I want to rollback my remote by 1 commit.

Say my history on master is A--B--C--D--E.
I want to rollback my local to D.
Then push it to remote so my current hash will be D both remote and local.

I’m having issues doing this.
I’m using Git Tower but am comfortable with the command line. Any help?

UPDATE:
Great comments below. Using a reset seems to be partially discouraged especially if the repository is shared with other users.
What’s the best way to undo the previous commit’s changes without using a hard reset? Is there a way?

15 Answers
15

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *