Skip to content

Instantly share code, notes, and snippets.

@derdesign
Forked from HashNuke/gist:608259
Last active December 11, 2015 20:08
Show Gist options
  • Save derdesign/4652769 to your computer and use it in GitHub Desktop.
Save derdesign/4652769 to your computer and use it in GitHub Desktop.
Useful git commands
# To undo a git push
git push -f origin HEAD^:master
# To get to previous commit (preserves working tree)
git reset --soft HEAD
# To get back to previous commit (you'll lose working tree)
git reset --hard HEAD^
# To get back to a specific commit
git reset --hard <sha1-commit-id>
# To force update the remote repo
git push origin HEAD --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment