Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Git useful commands

Add alias for displaying the status

git config --global alias.s status

Display current configuration

git config --list

Add user configuration

git config --global user.name "Your Name"
git config --global user.email "name@mail.com"

Set pull/rebase behavior

git config --global pull.rebase true

Set the remote as upstream:

git config --global push.autoSetupRemote true

Remove remote branches from local repository

git remote prune origin

Delete the local branch that was pruned

git branch -D name-of-the-branch-to-delete

Show all branches

git branch -a

Discover changes between two branches

git diff --name-status branch_one..branch_two

Compare two branches

git diff branch_one..branch_two

Use another identity

git config core.sshcommand "ssh -i ~/.ssh/your_private_key -o IdentitiesOnly=yes -F /dev/null"

Remove last commit

git reset --hard HEAD^
git push origin -f