Skip to content

Instantly share code, notes, and snippets.

@askalee
Last active June 22, 2018 01:49
Show Gist options
  • Save askalee/2dbb50e1dd178569029bf35de58d300d to your computer and use it in GitHub Desktop.
Save askalee/2dbb50e1dd178569029bf35de58d300d to your computer and use it in GitHub Desktop.
git: command line essentials

Git alias

git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

🍎 Note: all the following commands assume that the above aliases have been set

Get remote commits

Rebase my local commits on top of the remote commits

git pull --rebase

Don't rebase or merge, only fast forward

git pull --ff-only

See what's in the remote commits in advance

git fetch
git lg

See more log details

git lg --stat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment