git config
git config --global alias.b branch
git config --global alias.s status
git命令自动补全
- 安装 git completion
brew install git-completion
- 下载git源码,找到git-completion.sh((contrib/completion)并复制。
git clone https://github.com/git/git.git
git显示分支
在.bash_rc增加
function git_branch {
branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`"
if [ "${branch}" != "" ];then
if [ "${branch}" = "(no branch)" ];then
branch="(`git rev-parse --short HEAD`...)"
fi
echo " ($branch)"
fi
}
export PS1='\u@\h \[\033[01;36m\]\W\[\033[01;32m\]$(git_branch)\[\033[00m\] \$ '
Refs:
- https://git-scm.com/book/zh/v1/Git-%E5%9F%BA%E7%A1%80-%E6%8A%80%E5%B7%A7%E5%92%8C%E7%AA%8D%E9%97%A8
- https://www.jianshu.com/p/40e25d964d2f
- https://gist.github.com/yisibl/8281454
作者
白杨
发表于
2018-03-01 14:47:51
,并被添加「
git
」标签
,最后修改于
2018-03-07 11:12:49
本博客来自【白杨的博客】, 转载请注明出处,谢谢合作~
Comments
暂不支持评论,如有问题,请发邮件至baiyang.feng@outlook.com。 望不吝赐教~