改写历史,永久删除git库的物理文件

leetcode题解https://github.com/DaI253/leetcode-cpp,包含大量pdf历史文件,准备清理其中的历史文件,缩小项目体积。

http://my.oschina.net/jfinal/blog/215624 

git filter-branch --tree-filter 'rm -f *.pdf' --tag-name-filter cat -- --all
git push origin --tags --force
git push origin --all --force

 

另一个常用命令,查看文件夹容量

du查看目录大小,df查看磁盘使用情况。
我常使用的命令(必要时,sudo使用root权限),
1.查看某个目录的大小:du -hs /home/master/documents
 查看目录下所有目录的大小并按大小降序排列:sudo du -sm /etc/* | sort -nr | less
2.查看磁盘使用情况(文件系统的使用情况):sudo df -h
df --block-size=GB
 
-h是使输出结果更易于人类阅读;du -s只展示目录的使用总量(不分别展示各个子目录情况),-m是以MB为单位展示目录的大小(当然-k/-g就是KB/GB了)。
更多信息,还是man du 和 man df 来获得吧。

 

 

 

 

Ignore files that have already been committed to a Git repository

http://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository

如何删除github上的一个项目的内容,重新提交所有内容

http://segmentfault.com/q/1010000000250171

git rebase 更改历史树

http://www.cnblogs.com/dabaopku/archive/2012/06/24/2559652.html

posted @ 2015-07-09 16:13  daijkstra  阅读(402)  评论(0编辑  收藏  举报