Skip to content

Instantly share code, notes, and snippets.

@ChelseaSkovgaard
Last active October 31, 2016 15:32
Show Gist options
  • Save ChelseaSkovgaard/abd6d3b22fe59e586c89b2d7993f25ca to your computer and use it in GitHub Desktop.
Save ChelseaSkovgaard/abd6d3b22fe59e586c89b2d7993f25ca to your computer and use it in GitHub Desktop.
Git Commands

GIT COMMANDS

  • git stash - stash changes of a dirty working directory away in order to go back to a clean directoy
  • git stash list - to see the stashes you've stored
  • git stash apply - apply changes of what you stashed, uses the most recent one unless specified
  • git stash show -p | git apply -R - unapplys the stash you added
  • git shortlog - shows list of authors and commits
  • git commit --amend - edit the commit message
  • git reset --hard - reverts to previous commit
  • git reset --soft - will undo the last commit, but the file changes will stay in your working tree
  • git reset --hard HEAD~2 -

Find three different ways to display the git log. One example is git log --oneline.

  • git log --oneline - condenses each commit to single line
  • git log --oneline --decorate - display all of the references (e.g., branches, tags, etc) that point to each commit
  • git log --stat option displays the number of insertions and deletions to each file altered by each commit (note that modifying a line is represented as 1 insertion and 1 deletion)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment