Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thomschlereth/2e97ac79086d13dfb5e54d8d640d20dc to your computer and use it in GitHub Desktop.
Save thomschlereth/2e97ac79086d13dfb5e54d8d640d20dc to your computer and use it in GitHub Desktop.
git stash - allows you to switch branches without having to commit half done work. It doesn't delete it it just temporarily "stashes" the code away.
git stash list- show you a list of all the code that's been stashed
git stash apply - allows you to retrieve the previously stashed code. apply defaults to the latest stashed code, but you can specify the name of the stash you want to reapply. like so:
```
git stash apply stash@{2}
```
git shortlog - summarizes each commit msg, suitable for release anouncements. groups each commit by author and title
git commit --amend - allows you to amend most recent commit msg, but only if it hasn't been pushed to repository
git reset --hard - resets the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded.
git reset --soft - does not touch the index file or the working tree at all
git reset --hard HEAD~2 resets back the number of commits specified after HEAD~
Find three different ways to display the git log. One example is git log --oneline.
git log - display entire git log
git log --oneline - displays entire git log condensed
git log --skip=<number> - display entire git log after skipping number of commits specified
git log --until=<date> - shows entire git log before specified date
--before=<date>
git log --since=<date> - shows entire git log after specified date
--after=<date>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment