I would like to use shortcuts or aliases for git commands.
git diff git status git push git pull git stash git branch -a
How do I create shortcuts or aliases, is there a predefined list?
Add git alias The simplest way to add a git alias is by running a command to add the alias to the git global configuration file. For example, running the command git config --global alias. hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short" will add the alias git hist .
Press 'Start' button in Windows, type 'cmd' in the search field on the bottom of menu. There you have the command line console. Try to type git --version , if show something like 'git version 1.8. 0.2', you're ready to input all the commands here.
Git aliases are a powerful workflow tool that create shortcuts to frequently used Git commands. Using Git aliases will make you a faster and more efficient developer. Aliases can be used to wrap a sequence of Git commands into new faux Git command.
Put this into your .gitconfig
[alias] st = status ci = commit br = branch co = checkout
You can add as much as you want
git config --global alias.<short> <long>
e.g.
git config --global alias.cob "checkout -b"
(Without --global
, you get per-project aliases.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With