之前git远程仓库中有许多commit超过100M的大文件,不想让其占git服务器空间,让其初始化仓库,重新管理代码(此操作会把没有被引用的commit从磁盘上删除,请考虑清楚后再操作,如果被tag引用则不会被删除)。
mkdir your_git_repos
cd your_git_repos
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin git@git.dev.itsnow.com:your_group/your_remote_git_repos.git
git push origin master --force
到你远程仓库的项目目录下运行如下命令:
git gc --prune=0
PS:你的项目必须确保是unprotect的,才能用force参数。