Git/清理:修订间差异
来自康健生活
| (未显示同一用户的1个中间版本) | |||
| 第10行: | 第10行: | ||
git checkout --orphan <new-branch-name> | git checkout --orphan <new-branch-name> | ||
git add . | git add . | ||
git commit -am " | git commit -am "init" | ||
git branch - | // 删除所有本地旧分支 | ||
git branch - | git branch -d <old-branch-name> | ||
git | // 删除所有远程旧分支, 主分支需要临时打开分支保护 | ||
git push origin :<old-branch-name> -f | |||
git checkout -b <main-branch-name> | |||
// 推送新的主分支到远程 | |||
</syntaxhighlight>|$|/home/kangkk}} | |||
== 大文件 == | |||
检索 git 项目目录 | |||
{{shc|<syntaxhighlight lang="bash"> | |||
git rev-list --objects --all</syntaxhighlight>|$|/home/kangkk}} | |||
延申出 | |||
{{shc|<syntaxhighlight lang="bash"> | |||
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -5 | awk '{print$1}')"</syntaxhighlight>|$|/home/kangkk}} | |||
删除大文件 | |||
{{shc|<syntaxhighlight lang="bash"> | |||
git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch <文件路径名称>' --prune-empty --tag-name-filter cat -- --s</syntaxhighlight>|$|/home/kangkk}} | |||