Skip to content

Instantly share code, notes, and snippets.

@leeroybrun
Last active August 29, 2015 14:01
Show Gist options
  • Save leeroybrun/11c20d830647ce3e7100 to your computer and use it in GitHub Desktop.
Save leeroybrun/11c20d830647ce3e7100 to your computer and use it in GitHub Desktop.
Git tips
http://stackoverflow.com/questions/1338728/delete-commits-from-a-branch-in-git
Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES. Be sure to stash any local changes you want to keep before running this command.
git reset --hard HEAD~1
or
git reset --hard <sha1-commit-id>
Repush :
git push origin HEAD --force
http://stackoverflow.com/questions/179123/edit-an-incorrect-commit-message-in-git
git commit --amend -m "New commit message"
http://stackoverflow.com/questions/1338728/delete-commits-from-a-branch-in-git
git push origin HEAD --force
http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
git rebase -i HEAD~4
pick 01d1124 Adding license
squash 6340aaa Moving license into its own file
squash ebfd367 Jekyll has become self-aware.
squash 30e0ccb Changed the tagline in the binary, too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment