Skip to content

Instantly share code, notes, and snippets.

@JaredRoth
Last active April 14, 2016 16:03
Show Gist options
  • Save JaredRoth/f88c75ec829265ac231b971a523e8a10 to your computer and use it in GitHub Desktop.
Save JaredRoth/f88c75ec829265ac231b971a523e8a10 to your computer and use it in GitHub Desktop.
  • git stash
    • Records the current state of your directory without committing. Restores directory to match HEAD.
  • git stash apply
    • Restores the previous stash. Will overwrite commits.
  • git shortlog
    • Groups git log by author and displays only the commit headers (not the messages or any other log info).
  • git commit --amend
    • Replaces the last commit with this one, adding to the message. (Do not do this if the commit has already been published)
  • git reset --hard
    • Discards all changes since the last commit
  • git reset --soft
    • Resets the head but does not alter files. (Allowing you to commit them on another branch, for instance, if you found you were accidentally on master/ the wrong branch)
  • git reset --hard HEAD~2
    • Resets the branch to it's state before the last two commits
  • Find three different ways to display the git log. One example is git log --oneline.
    • git log -'number' to limit
    • git log --graph --oneline --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment