Skip to content

Instantly share code, notes, and snippets.

@marinacor1
Created April 14, 2016 15:38
Show Gist options
  • Save marinacor1/f977ed24b1ff1874afc21ebf75065371 to your computer and use it in GitHub Desktop.
Save marinacor1/f977ed24b1ff1874afc21ebf75065371 to your computer and use it in GitHub Desktop.
git stash: stores the latest changes you've made to a secret chamber and returns your working directory to the match the last commit (can get it back by using git pop)
git stash apply: restores the git stash, potentially on top of a different commit
git shortlog: summarizes git log output (commits re grouped by author and title)
<img width='1224' height='1154' title='' alt='' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABMgAAASCCAYAAABHDdAFAAAMGWlDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnltSCAktEAEpoTdBepXeBQHpYCMkAUIJIRBU7OiigmsXC1Z0FUTBtQCyqIgoFhYBe90goqKsiwUbKm+SALruK9873zd3/pw558x/zp25mQFA0Z4lEGSiSgBk8fOEkYE+zPiERCZJDBCAA3lgAJgsdq7AOyIiFEAZ7f8u725CayjXLCWx/jn+X0WZw81lA4BEQJzMyWVnQXwcAFyTLRDmAUDogHqD2XkCCX4LsaoQEgSASJbgVBnWkuBkGbaW2kRH+kLsBwCZymIJUwFQkMRn5rNTYRwFAcTWfA6PD/FuiD3YaSwOxGKIJ2RlZUOsSIXYNPm7OKl/i5k8FpPFSh3Ds...
git commit --amend: fixes most recent commit, can edit or combine staged changes with the previous commit
git reset --hard(with commit number) : takes your current branch back to point of commit number (all changes after this commit are discarded)
git reset --soft : doesn't change index file or working tree but resets the head to commit, leaves all changed files as changes to be committed
git reset --hard HEAD~2: resets to a different head
Three ways to display git log:
1. git log --stat : allows you to see changes in modified file (kind of like when you do a git pull origin master)
2. git log --prety= oneline: Allows you to see it in one line and neat
3. git log -p: lets you see the difference in each commit
For better information on git log, check this out: https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment