Last active
May 4, 2021 22:31
-
-
Save amatellanes/9328323 to your computer and use it in GitHub Desktop.
Handy Git commands
This file contains 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
$ git reset --hard HEAD~1 | |
$ git push -f # removes last commit. | |
$ git diff --staged # will show you the diff that you're about to commit. | |
$ git commit -am "First commit" # adds all changes to tracked files and uses the commit message from the command-line. | |
$ git diff -M # only considers a file that disappeared as the source of a rename. | |
$ git diff -b # the -b means ignore whitespace, useful since we've changed some html indenting. | |
$ git log -n 1 --format=%H # Gets the hash of the current commit that’s in your local tree. | |
$ git log --graph --oneline --decorate # Shows repo history. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment