公钥私钥生成
ssh-keygen -t ed25519 -C "1329441308@qq.com"
# 测试密钥能否使用
ssh -T git@github.com
Git 浅拷贝(shallow clone)
# 控制 clone 历史长度
git clone --depth depth remote-url
# clone 单个分支
git clone URL --branch branch_name --single-branch [folder]
用户设置
git config --global user.name "yeshan333"
git config --global user.email "1329441308@qq.com"
git config --global core.fileMode false # linux 忽略文件权限的追踪
## gpg 签名开启
git config --global gpg.program "/usr/local/bin/gpg"
git config --global commit.gpgsign true
Git Commit 签名
.gitconfig
[user]
name = yeshan333
email = 1329441308@qq.com
[gpg]
program = F:\\GnuPG\\bin\\gpg.exe
[commit]
gpgsign = true
[core]
aurocrlf = true
Git Log 格式化输出
https://stackoverflow.com/questions/1441010/the-shortest-possible-output-from-git-log-containing-author-and-date %h = abbreviated commit hash
%x09 = tab (character for code 9)
%an = author name
%ad = author date (format respects —date= option)
%s = subject
git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
前端项目检查 commit message 之 commitlint
- https://github.com/conventional-changelog/commitlint
冲突解决方案
git pull --no-rebase