git alias

379 阅读1分钟

编辑gitconfig文件 vim ~/.gitconfig

配置如下,重点在[alias]:

# This is Git's per-user configuration file.
[merge]
    summary = true
    tool = vimdiff
[diff]
    renames = copy
[color]
    diff = auto
    status = true
    branch = auto
    interactive = auto
    ui = auto
    log = true
[status]
    submodulesummary = -1
[mergetool "vimdiff"]
    cmd = "vim --noplugin \"$PWD/$MERGED\" \
          +\":split $PWD/$REMOTE\" +\":set buftype=nowrite\" \
          +\":vertical diffsplit $PWD/$LOCAL\" +\":set buftype=nowrite\" \
          +\":vertical diffsplit $PWD/$BASE\" +\":set buftype=nowrite\" \
          +\":wincmd l\""
[format]
    numbered = auto
[alias]
    b = branch
    ca = commit -a
    cm = commit -m
    cp = cherry-pick
    co = checkout
    ci = commit
    st = status
    pl = pull
    ps = push
    pso = push origin
    plo = pull origin
    dt = difftool
    l = log --stat
    ga = git add .
    gb = git branch
    gc = git checkout
    gd = git diff
    gcd = git checkout develop
    gcm = git commit -m
    gl = git pull
    glo = git pull origin
    gp = git push
    gpo = git push origin
    gst = git status
[user]
	name = xxx
	email = xxx
[core]
    excludesfile = /Users/bubu/.gitignore_global
[difftool "sourcetree"]
    cmd = opendiff \"$LOCAL\" \"$REMOTE\"
    path =
[mergetool "sourcetree"]
    cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
    trustExitCode = true%