Skip to content

Instantly share code, notes, and snippets.

@jdliss
Last active April 14, 2016 15:37
Show Gist options
  • Save jdliss/bc9463d9c09b96c7443a3d1d7e384809 to your computer and use it in GitHub Desktop.
Save jdliss/bc9463d9c09b96c7443a3d1d7e384809 to your computer and use it in GitHub Desktop.

git stash

  • Use when you want to store your local changes, but revert back to the current state of the HEAD commit

git stash apply

  • use this when you want to reapply the most recent stash you made. git stash apply stash@{2} will apply the second most recent, etc.

git shortlog

  • formats git log into a more readable format for something like a release announcement. Groups commits by author and title

git commit --amend

  • you can amend files to the previous commit. If not message is given it will use the previous commit message

git reset --hard

  • throws away all uncommitted changes and moves HEAD back to previous commit

git reset --soft

  • moves HEAD back, but stages changes. You can git commit after this and it should push your changes up

git reset --hard HEAD~2

  • throws all uncommitted changes away and moves HEAD back two commits

three different ways to display git log

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