git用时间长了文件就会特别大,尤其是二进制文件,如果我们不想要这些历史记录的话,就可以通过下面方法删除掉。

删记录

删除前一定要先push一下
删除前一定要先push一下
删除前一定要先push一下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
1.Checkout

git checkout --orphan latest_branch

2. Add all the files

git add -A

3. Commit the changes

git commit -am "commit message"


4. Delete the branch

git branch -D master

5.Rename the current branch to master

git branch -m master

6.Finally, force update your repository

git push -f origin master

参考资料

https://blog.czbix.com/remove-git-history.html