git config文件總結及git alias配置


1. 文件位置

mac

/etc/.gitconfig 系統級
~/.gitconifg 用戶級(覆蓋系統級)

windows

C:\Users\$user\.gitconfig

當前項目下

.git/.gitconfig(覆蓋用戶級)

2.配置用戶名和郵箱

全局

$ git config --global user.name  ygtzz
$ git config --global user.email ygtzz@126.com

局部(當前項目)

$ git config user.name  ygtzz
$ git config user.email ygtzz@126.com

3.快速打開gitconfig

git config [--global] --edit

4.修改編輯器

$ git config --global core.editor emacs

5.查看gitconfig內容

$ git config --list

git alias配置

[alias]
st = status -sb
co = checkout
br = branch
mg = merge
ci = commit
ds = diff --staged
dt = difftool
mt = mergetool
last = log -1 HEAD
latest = for-each-ref --sort=-committerdate --format=\"%(committername)@%(refname:short) [%(committerdate:short)] %(contents)\"
ls = log --pretty=format:\"%C(yellow)%h %C(blue)%ad %C(red)%d %C(reset)%s %C(green)[%cn]\" --decorate --date=short
hist = log --pretty=format:\"%C(yellow)%h %C(red)%d %C(reset)%s %C(green)[%an] %C(blue)%ad\" --topo-order --graph --date=short
type = cat-file -t
dump = cat-file -p
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
[core]
autocrlf = true
[push]
default = simple

 

參考:http://blog.csdn.net/joe_007/article/details/7276195
   http://blog.csdn.net/shrimpcolo/article/details/49302619


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM