2024#
Ref Video[1]1. 将当前未 tracked files 一起暂存#
git config --global alias.staash 'stash --all'2. Conditional Configs#
// root/.gitconfig
// 对于特定目录下的项目,使用特定的 git config
// 注意:current config = root configs + specific config(相同项会覆盖前者)
[includeIf "gitdir:~/t/"]
path= ~/t/.gitconfig3. no git blame -L, just log -L#
🚫 git blame -L <start>,<end> path/to/file
👍 git log -L <start>,<end>:path/to/file
👍 git log -L:<func_name>:path/to/file4. diff word-by-word#
👍 git diff --word-diff path/to/file5. rerere[2][2]" role="complementary" aria-hidden="true">#
“重用记录的解决方案(reuse recorded resolution)”所示,它允许你让 Git 记住解决一个块冲突的方法, 这样在下一次看到相同冲突时,Git 可以为你自动地解决它。
6. signing commit with ssh#
对提交进行签名,防止伪造的 user.name/user.email 提交
需要将 pub.key 预先上传到 code repo server
git config gig.format ssh
git config user.signingkey ~/.ssh/pub.key