Typing git status every time you wanted to show the working tree status has been a bit verbose. Fortunately, Git lets you create aliases, which are shortcuts to other commands. Let’s create a few aliases for our most common commands:
git config --global alias.ss status
git config --global alias.l1 "log --oneline"
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.br branch
git config --global alias.brr "branch -r"
git config --global alias.clos "config -l --show-origin --show-scope"
git config --global alias.loh "log origin..HEAD"
git config --global alias.lho "log HEAD..origin"
Now, we can use git co
instead of git checkout
, git ci
for committing, and git br
for listing branches. We can even use git br <branch-name>
for creating a new branch etc..
Aliases will make our life easier.
本作品採用《CC 協議》,轉載必須註明作者和本文連結