配置自己的用户名和邮箱
1 | git config --global user.name "你的名字或昵称" |
生成ssh公钥
生成ssh key1
2ssh-keygen -t rsa -C "xxxxx@xxxxx.com"# Creates a new ssh key using the provided email
# Generating public/private rsa key pair...
查看public key1
2cat ~/.ssh/id_rsa.pub
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....
从众多提交中保留只需要的提交
1 | git cherry-pick <commit id> |
如果没有冲突,则显示如下:1
2
3Finished one cherry-pick.
# On branch dev
# Your branch is ahead of 'origin/dev' by 3 commits.
如果存在冲突,则需要解决冲突然后继续。
改写历史,去除大文件(减小仓库体积)
1 | git filter-branch --tree-filter 'rm -f path/to/large/files' --tag-name-filter cat -- --all |