git 配置信息以及git 别名,例如 使用co来简写checkout。
在~目录下编辑.gitconfig文件,内容信息如下。
[user]
name = wangxinli
email = wangxinli@derbysoft.com
[core]
autocrlf = input
[push]
default = simple
[http]
sslVerify = false
[alias]
co = checkout
ci = commit
st = status
sh = stash
sa = stash apply
sp = stash pop
ap = add -p
br = branch
cp = checkout -p
cv = commit -v
dc = diff --cached
d = diff
pr = pull --rebase
ps = push
l = log --graph --pretty=format:'%C(yellow)%h%Creset %C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=short --all
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all
在平常的工作中,如果想避免每次提交都输入帐号和凭证信息,可以使用如下的命令
cd ~
touch .git-credentials
vim .git-credentials
在vim中输入如下的信息
https://{username}:{password}@github.com
请将username和password替换为你的帐号信息。
然后在命令行中输入
git config --global credential.helper store
再次打开 ~/.gitconfig文件,会发现多了一行
[credential]
helper = store
然后就可以愉快的做开发工作了。