Skip to content

Instantly share code, notes, and snippets.

@lixingcong
Last active April 9, 2019 09:04
Show Gist options
  • Save lixingcong/7ed5b6da56b56dae34eeac5e47f34a11 to your computer and use it in GitHub Desktop.
Save lixingcong/7ed5b6da56b56dae34eeac5e47f34a11 to your computer and use it in GitHub Desktop.
A simple configure template for git commands. 注意:不再更新,新版存放在Dropbox上 2019-04-09
[user]
name = xxx
email = [email protected]
signingkey = 37A9AD93
[push]
default = simple
[alias]
ad = add *
cm = commit -am
cmt = commit -m
cma = commit --amend
st = status -s
ps = push
df = diff
sh = show
# log: history of a file
shf = log -p
# log: last commit
ls = show HEAD
# log: log graph
lg = log --pretty=format:'%Cgreen %cd %Creset%s' --graph --date=format:'%Y-%m-%d %a %H:%M:%S'
# log: all details
lg1 = log --pretty=format:'%Cred%h%Cgreen %cd %Creset%s%Cgreen(%cr)%C(yellow)<%an>' --graph --date=format:'%Y-%m-%d %a %H:%M:%S'
# log: modified files
lg2 = log --pretty=format:'%Cred%h%Cgreen %cd %Creset%s%Cgreen(%cr)%C(yellow)<%an>' --stat --date=format:'%Y-%m-%d %a %H:%M:%S'
# log: current branch
lg3 = log --oneline --decorate
# log: filtered by author
lg4 = shortlog --pretty=format:'%Cgreen(%cr) %Creset%s' --reverse
# TODO add
tda = "!f() { git commit --allow-empty -m \"TODO: $@\"; }; f"
# TODO log
tdl = "!f() { git lg1 --grep=\"^TODO:\"; }; f"
# TODO rebase(then delete the TODO commit)
tdr = "!f() { git tdl; echo -n \"Rebase the TODO commit: \";read base; git rebase -i $base~1; }; f"
# tag history
tagl = tag -ln
# tag push
tagp = push --tags
# tag delete local
tagd = tag --delete
# tag delete remote(local tag would be deleted!)
tagdr = "!f() { git tagd $1 && git push origin :refs/tags/$1; }; f"
# checkout
co = checkout
# branch
br = branch
# branch create
brn = checkout -b
# branch delete local
brd = branch -D
# branch delete remote
brdr = push origin --delete
[credential]
helper = cache
[help]
autocorrect = 15
[core]
# set tab size = 4 space in git diff
pager = less -x1,5
# diff-so-fancy: https://github.com/so-fancy/diff-so-fancy
#pager = /home/li/programs/diff-so-fancy/diff-so-fancy | less --tabs=4 -RFX
editor = vim
# Linux: Checkout as-is, commit Unix-style
autocrlf = input
# Windows: Checkout Windows-style, commit Unix-style
#autocrlf = true
[color]
ui = true
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = yellow
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
[core]
# set tab size = 4 space in git diff
pager = less -x1,5
quotepath = false
[gui]
recentrepo = H:/adtech/MFC2/MFC2
encoding = gbk
[i18n "commit"]
encoding = gbk
[i18n]
logoutputencoding = gbk
[diff]
tool = bc
[difftool "bc"]
path = F:\\Program Files\\Beyond Compare 4\\BComp.exe
[merge]
tool = bc
[mergetool "bc"]
path = F:\\Program Files\\Beyond Compare 4\\BComp.exe
# ------------------ M E R G E -------------------------
[merge]
tool = meld
[mergetool "meld"]
cmd = meld --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\" --label \"MERGE (REMOTE BASE MY)\"
trustExitCode = false
[mergetool]
# don't ask if we want to skip merge
prompt = false
# don't create backup *.orig files
keepBackup = false
# ------------------ D I F F -------------------------
[diff]
guitool = meld
[difftool "meld"]
cmd = meld \"$LOCAL\" \"$REMOTE\" --label \"DIFF (ORIGINAL MY)\"
@lixingcong
Copy link
Author

提示SSL证书问题:

$ git pull
fatal: unable to access 'https://github.com/acgotaku/BaiduExporter.git/': error setting certificate verify locations:
  CAfile: F:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
  CApath: none

执行

git config --system http.sslcainfo "C:\Program Files (x86)\git\bin\curl-ca-bundle.crt"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment