Skip to content

初始化 ​

sh
# 查看 git 全局配置


<NolebasePageProperties />




git config --global --list

# 使用 VSCode 编辑
code ~/.gitconfig

# 编辑 git 配置文件
[user]
	name = rover
	email = lkay2333@gmail.com
	useConfigOnly = true
[pull]
  rebase = true
  autosetuprebase = always
[push]
	default = current
	autoSetupRemote = true
[color]
  ui = auto
  diff = auto
  status = auto
  branch = auto
# network proxy
[http]
	proxy = socks5://127.0.0.1:6153
	postBuffer = 655360000
[https]
	proxy = socks5://127.0.0.1:6153
[branch]
  autosetuprebase = always
[alias]
  aa = add --all
  bv = branch -vv
  ba = branch -a
  bd = branch -d
  cl = clone
  cm = commit -m
  ca = commit --amend
  df = diff
  lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
  ls = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
  mm = merge --no-ff
  p = pull --rebase
  pu = push
  rb = rebase
  sw = switch
  st = status
  tag = tag -a
  un = reset --hard HEAD
  uh = reset --hard HEAD^
[core]
	quotepath = false
	longpaths = true
	autocrlf = input
	trustctime = false
	excludesfile = ~/.gitignore_global
	attributesfile = ~/.attributes_global
	ignorecase = true
	untrackedcache = true
[init]
	defaultBranch = master
[filter "lfs"]
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true
	clean = git-lfs clean -- %f
[diff "text"]
	textconv = cat
[mergetool]
	keepBackup = false
[lfs]
	concurrenttransfers = 32
	fetchrecentrefsdays = 0
	pruneoffsetdays = 0
	dialtimeout = 3
	tlstimeout = 3
[lfs "transfer"]
	maxretries = 1
	maxretrydelay = 2
[merge "lfs-text"]
	driver = git lfs merge-driver --ancestor %O --current %A --other %B --marker-size %L --output %A --program 'git merge-file --stdout --marker-size=%%L %%A %%O %%B >%%D'
[rebase]
	backend = merge
[protocol]
	version = 1
[safe]
	directory = *

Git 别名 ​

MacOS / Linux ​

bash, zsh, fish 的配置文件中添加

sh
alias gc='git clone'
alias gs='git status'
alias gd='git diff'
alias ga='git add .'
alias gap='git add -p'
alias gcm='git commit -m'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gb='git branch'
alias gba='git branch -a'
alias gp='git pull'
alias gpr='git pull --rebase'
alias gpu='git push'
alias gl='git log'
alias grl='git reflog'

Windows ​

如果你想在windows下使用 git别名 除了在 git bash中配置外,也可以为powershell 配置

powershell
# 在powershell配置文件中添加以下代码, 如果没有该配置文件可以运行 创建配置文件

贡献者

The avatar of contributor named as rover rover

页面历史

Power by nolebase