Last active
August 29, 2015 14:01
-
-
Save leeroybrun/11c20d830647ce3e7100 to your computer and use it in GitHub Desktop.
Git tips
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/179123/edit-an-incorrect-commit-message-in-git | |
git commit --amend -m "New commit message" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/1338728/delete-commits-from-a-branch-in-git | |
git push origin HEAD --force |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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