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?

  • Nested git repositories without remotes (a.k.a. git submodule without remotes)
  • Solving undefined reference library linking error in gcc
  • How does initializing a repository with a README help in letting you immediately clone the repository to your computer?
  • Why does my Eclipse “count objects” before pushing upstream to GIT each time
  • How do I use vim as 'git log' editor?
  • Git commands with double dashes
  • Change the root directory of a Git repository
  • No newline at end of file
  • Eclipse Git plugin - remove file from repo without deleting local
  • what is fast-forwarding push in the Git?
  • How can I restore a Git repo and its Github remote to a previous commit without using reset?
  • Difference between Git and libgit2
  • 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.