公钥私钥生成

  1. ssh-keygen -t ed25519 -C "1329441308@qq.com"
  2. # 测试密钥能否使用
  3. ssh -T git@github.com

Git 浅拷贝(shallow clone)

  1. # 控制 clone 历史长度
  2. git clone --depth depth remote-url
  3. # clone 单个分支
  4. git clone URL --branch branch_name --single-branch [folder]

用户设置

  1. git config --global user.name "yeshan333"
  2. git config --global user.email "1329441308@qq.com"
  3. git config --global core.fileMode false # linux 忽略文件权限的追踪
  4. ## gpg 签名开启
  5. git config --global gpg.program "/usr/local/bin/gpg"
  6. git config --global commit.gpgsign true

Git Commit 签名

image.png

.gitconfig

  1. [user]
  2. name = yeshan333
  3. email = 1329441308@qq.com
  4. [gpg]
  5. program = F:\\GnuPG\\bin\\gpg.exe
  6. [commit]
  7. gpgsign = true
  8. [core]
  9. 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

  1. git log --pretty=format:"%h%x09%an%x09%ad%x09%s"

前端项目检查 commit message 之 commitlint