Undo a Git commit after push using reverse patch?

I’ve pushed a commit and I want to revert changes introduced by this commit by applying and committing a reversed patch. How do I do it?

  • Several SSH keys and user accounts
  • git shows that I deleted all the files in my repo and staged them for commit after I did a git pull. Why?
  • 'rm' + 'svn update' equivalent in Git?
  • Setting up a project directory structure for git repo of a website
  • Git repository server I can host locally
  • How to connect existing Android Studio project to existing Github repository
  • How to remove history of deleted git subtree folder?
  • Using GitSharp to PUSH changes
  • GIT — Exclude / Ignore Files from commit
  • How can a one-entry git repo be in detached head status?
  • How can I make visual studio use the same powershell that Github for windows does
  • Switch users in git
  • 3 Solutions collect form web for “Undo a Git commit after push using reverse patch?”


    git revert HEAD

    This will create a patch that reverts the last commit and commit that patch as a new commit.

    If you want to revert a specific earlier version, use

    git revert <revision>

    see also: http://schacon.github.com/git/git-revert.html

    simply use

    for committed file:

    git revert <SHA1 ID>

    for non-committed file:

    git reset --hard HEAD
    Git Baby is a git and github fan, let's start git clone.