Daily GIT commands

coding, git, terminal 1 min read

This is a list of all the git commands I use on a daily basis at work and home.

git log -p -1
# This will display the last commit differences - very useful after you rebase and squash the code into one commit
git diff origin --full-index > <diff-file-name>
# Generates the difference between the branch and master and dump it in a file
git rev-list master.. --count
# Count the number of commits from master
Git rebase -i HEAD~n
# Rebase interactively so you can squash your commits
Git show --summary 
# Checks the last commit summary
git reset --soft HEAD~1
# Reset the last commit
git reset HEAD <file>
# Unstage a file in git
git clean -fdx 
# Cleans all the ignored files and folders
ssh-add -K 
# Adds the key to keychain so you dont type the passphrase over and over again
# Not on a daily uses basis.