Aliases in Git

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 协议》,转载必须注明作者和本文链接
日拱一卒
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!
未填写
文章
88
粉丝
82
喜欢
148
收藏
120
排名:66
访问:11.4 万
私信
所有博文
社区赞助商