Site menu

CodeCook.io

  • Languages
    • C
    • C++
    • CSS
    • Git
    • HTML
    • Java
    • JavaScript
    • jQuery
    • PHP
    • Python
    • Ruby
    • Scala
  • published
  • repository
  • undo

Git - Undo published commit

Revert changes that are already published to other repositories.

Commit hash
1
553
  • Share on Facebook
  • Share on Google+
  • Share on Twitter

Using revert

Creates a new commit with changes to undo changes of the previous commit.

git revert {{hash}}

Notes

last update: Oct. 27, 2014

0
525
  • Share on Facebook
  • Share on Google+
  • Share on Twitter

Reset and force push

Reset the head of the current branch to the previous commit discarding all changes. The remote repository can be updated by force pushing: "git push -f {{remote}}".

git reset --hard {{hash}}

Notes

  • Requires non-fastforward permissions on remote

last update: Oct. 27, 2014

Advertisement

This project is hosted on DigitalOcean, try it and support us

Related concept

  • Create git tag
  • Show changes since laste commit
  • Show working tree status
  • Add empty directory to git repository
  • Git commit changes
  • Create new repository

Random task

  • Random number
  • Check if specific commit is on remote
  • rounded-corners
  • If else
  • Escape variable tag
  • Blog
  • About
  • License