git手记

alias别名

总结了常用的git命令,便捷别名,vim ~/.gitconfig

[gui]
[user]
  name = Alex F. Zhang
  email = ***_work@163.com
[difftool "sourcetree"]
  cmd = '' \"$LOCAL\" \"$REMOTE\"
[mergetool "sourcetree"]
  cmd = "'' "
  trustExitCode = true
[alias]
  co = checkout
  br = branch
  st = status
  ci = commit
  fa = fetch --all
  pl = pull
  ps = push
  unstage = reset head^
  last = log -1 --name-only HEAD
  conf = config -l
  alias = config -l
  rb = branch -r
  tr = log -20 --oneline --graph --decorate
  log10 = log -10 --oneline --graph --decorate
  mg = merge --no-commit
  logaz = log --name-status --no-merges --author=\"author\" --pretty=\"%h, %s, %an\" # no merges
  mm = log -n 10 --oneline --author=\"author\" --pretty=\"%s\" # commit history messages
  logll = log --name-status --no-merges --author=\"linaliu\" --pretty=\"%Cgreen%H%Creset, %s, %an\"
  logsr = log -m --name-only --date=iso --pretty=\"%h, %s, %an, %ad\"
  loggrprw = log --name-only --author=\"ralphwang|Alex Zhang|linaliu\"
  ch = log -10 --author=\"Alex F. Zhang\" --pretty=\"%s\"
  logf = "!f() { git log --date=iso --pretty=\"%n%h|%an|%ad||%s\" -- \"${1}\"; }; f" # log for specified file
  loga = "!f() { git log --name-status --no-merges --date=iso --pretty=\"%n%h|%an|%ad|%s\" --author=\"${1}\"; }; f" # log for specified author
  log1 = log --no-merges --oneline --graph --decorate
  mdiff = "!f() { git diff --diff-filter=d --name-only ${1}^1...${1}^2; }; f"
  ndiff = "!f() { git diff --diff-filter=d --name-only ${1}^...${1}; }; f"
  logn = "!f() { git log -${1} ${2} --date-order --oneline --graph --decorate; }; f"
  hp = "!f() { git commit -a -m \"${1}\"; git push; }; f"
  ca = "!f() { git commit -a -m \"${1}\"; }; f" # git commit
[grep]
  extendedRegexp = true
[merge]
  tool = vscode
[mergetool "vscode"]
  cmd = "code --wait "
[diff]
  tool = bc3
[difftool "bc3"]
  cmd = "\"/c/Program Files/Beyond Compare 4/BComp.exe\"" \"$LOCAL\" \"$REMOTE\"
  trustExitCode = true
[gui]
[filesystem "Oracle Corporation|11.0.2|-635900934"]
  timestampResolution = 12001 microseconds
  minRacyThreshold = 0 nanoseconds
[http]
[push]
  default = current
[guitool "pull"]
  cmd = git pull
  noconsole = yes
[core]
  excludesfile = C:\\Users\\alexzhang\\Documents\\gitignore_global.txt
  autocrlf = false
  editor = vim
  eol = lf

GIT Bash快捷命令

alias c='clear'
alias d='. sd'
alias g='git'
alias l='git pull'
alias s='git push'
alias gst='git stash'
alias gsa='git stash apply'
alias log='git log --oneline --graph --decorate --date-order'

submodules

参考:Git-Submodules

git clone --recurse-submodules uri
git submodule update --init # already cloned

ignore __pycache__ folder

add __pycache__ into .git/info/exclude file

# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
parent_folder/__pycache__

配置代理

[user]
	name = your_id
	email = your_email
[http]
	proxy = http://domain_id:password@proxy_host:port/
	sslVerify = false
[https]
	proxy = http://domain_id:password@proxy_host:port/
	sslVerify = false
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值