git alias设置,简化git命令复杂度

2016-12-05  本文已影响0人  飞兔子

0:默认本地已安装git工具(windows)

1: 命令 cd ~ ,进入根目录,

2:命令 ls -la | grep .gitconfig,找到根目录下的 .gitdionfig文件

3: vi .gitconfig 修改这个文件的配置。

git config --globaluser.name"你的名字"

git config--globaluser.email"你的Email"

gitconfig配置.png

4:对应上图配置相关项

alias.ci=commit

alias.co=checkout

alias.br=branch

alias.lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(13)<%an>%Creset' --abbrev-commit

alias.lgd=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(13)<%an>%Creset' --abbrev-commit

alias.lg2=log --pretty=format:'%h - %an -%ad -%s' --graph

alias.lg4=log --color --graph --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(yellow)%d%C(13)<%an>%Creset' --abbrev-commit

alias.st=status -s

alias.sn=show --name-status

alias.cs=config --system --list

alias.sb=show-branch

alias.lg3=log --pretty=format:'%h - %cn -%cd -%s' --graph

5:1. 在 Fork 的代码库中添加上游代码库的 remote 源,该操作只需操作一次即可。

如: 其中# upstream 表示上游代码库名, 可以任意。

git remote -v 查看本地仓库和远程关联仓库

git remote add upstream https://github.scm.corp.ebay.com/montage/frontend-ui-workspace

git fetch upstream

git merge upstream/master   //合并一个远程取回的分支

相关命令 :http://blog.csdn.net/max2005/article/details/17355303

上一篇 下一篇

猜你喜欢

热点阅读