Skip to content

Instantly share code, notes, and snippets.

@Silverneo
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Silverneo/1f2c00a4a9b8043592c6 to your computer and use it in GitHub Desktop.
Save Silverneo/1f2c00a4a9b8043592c6 to your computer and use it in GitHub Desktop.

###Rolling back local and remote git repository

If nobody has pulled your remote repo yet, you can change your branch HEAD and force push it to said remote repo:

git reset --hard HEAD^ 
git push -f 

###What if somebody has already pulled the repo?

Then I would suggest something that doesn't rewrite the history:

  • git revert locally your last commit (creating a new commit that reverses what the previous commit did)
  • push the 'revert' generated by git revert.

From stackoverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment