git 配置

# 列出所有文件删除和新增的行数
git log --pretty=tformat: --numstat

# 粗略估计文件总数
git log --pretty=tformat: --numstat |wc -l

# 粗略估计总共add了多少行, 总共del了多少行, 以及当前有多少行
git log --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'

# --staged 只是 --cached 的別名
git diff --cached
git diff --staged

vi ~/.gitconfig

安装开源命令行对比工具 delta: https://github.com/dandavison/delta
详细设置delta:https://www.5axxw.com/wiki/content/xrx4vf

conda install git-delta -c conda-forge  #安装git-delta

[user]
	name = xx
	email = xx@xxxx.com

[core]
	attributesfile = ~/.gitattributes
	pager = delta
	quotepath = false
	
[credential]
	helper = cache --timeout=3600

[color]
	diff = auto
	status = auto
	branch = auto
	interactive = auto
	ui = true
	pager = true

[interactive]
	diffFilter = delta --color-only

[pull]
	rebase = true
	
[diff]
	colorMoved = default
	
[diff "image"]
	command = compare $2 $1 png:- | montage -geometry +4+4 $2 - $1 png:- | display -title \"$1\" -

[merge]
	conflictstyle = diff3
	ff = no
	commit = no

[delta]
	side-by-side = true
	line-numbers-left-format = ""
	line-numbers-right-format = "│ "
	syntax-theme = Nord
	navigate = true
	light = false

[clone]
	#recurseSubmodules = true

[alias]
	st = status
	br = branch
	lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
	last = log -1
	#清理当前分支的 git commit --amend 记录,因为 git reflog可以查看到,末尾加上 --all 清理所有分支
	clr= reflog expire --expire=now
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值