引言:由於有些git命令較長,記起來比較麻煩,為了git工具使用的方便,為命令列取別名有很大的必要。
1、在家目錄新增.gitconfig檔案。
此檔案在建立git倉庫時,一般是沒有的,需要手動新增。
2、配置.gitconfig檔案。
例如如下配置(左邊的別名可以按照個人習慣取):
注意:以上配置方法為全域性配置,如只需要某乙個git倉庫生效命令別名配置,則.gitconfig檔案,在當前git倉庫的根目錄建立配置即可,方法和全域性配置方式一樣。[alias]
br = branch
ci = commit
cl = clone
co = checkout
cp = cherry-pick
cfg = clone
df = diff
fh = fetch
lg = "log --color --graph --pretty=format:'%cred%h%creset -%c(yellow)%d%creset %s %cgreen(%cr) %c(bold blue)<%an>%creset' --abbrev-commit --date=relative"
mg = merge
pl = pull
plr = pull --rebase
rb = rebase
ph = push
rmt = remote
rst = reset
sh = stash
st = status
sts = status -s
sbm = submodule
sw = show
swf = "show --name-status"
delb = "push origin --delete"
delt = "push origin :"
mb = merge-base
git 命令列 和 cmd命令列
設定全域性使用者名稱 git config global user.name 區域性把global換成local 檢視全域性 git config global list 檢視git的狀態 git status 初始化 git into 名字 新增乙個檔案 git add readme.txt 刪除...
git 配置組合指令 Git命令列基本操作
先來看看圖的介紹吧 0.安裝git 網上有很多git安裝教程,如果需要圖形介面,windows下建議使用tortoisegit,linux建議使用git gui或者gitk。1.git基本配置 git config可以配置git的引數,可以使用git config list檢視已經配置的git引數。...
Git 命令列基礎
git是乙個開源的分布式版本控制工具 配置身份 配置身份 git config global user.name tony git config global user.email tony gmail.com 檢查是否配置成功 檢查配置 git config global user.name gi...