开发者

Bad commit to Git

开发者 https://www.devze.com 2022-12-19 20:43 出处:网络
Okay, about 700 commits ago (>30 days) I accidently saved ThirdParty/mapper/Songbird_1.2.0-1146_windows-i686-msvc8.exe (iTunes type of download) in my local Git repository without noticing, which was

Okay, about 700 commits ago (>30 days) I accidently saved ThirdParty/mapper/Songbird_1.2.0-1146_windows-i686-msvc8.exe (iTunes type of download) in my local Git repository without noticing, which was also pushed to remote hosted git repository, I noticed the other day the repo was in excess of 200mb, whilst I was expecting about 20mb.

I have followed the instructions in: http://github.com/guides/completely-remove-a-file-from-all-revisions

As well as running git gc --aggressive --prune, but the local directory remains in excess of 200mb. Before i can sort the remote repo I need to sort my local, is there something special about my case (i.e. massive file, long time ago commit). How can I entirely remove this file and bring the directory down to the correct size?

Note to avoid migration: I feel this is more suited to Stac开发者_Go百科kOverflow since Git is primarily a local developers tool at the moment, community supported and not part of any mainstream distros or expectation of sysadmins, i.e. at the moments dev know the admin of git the best.


I wrote about a similar problem in "git: shrinking Subversion import."

The git filter-branch manpage has a checklist for shrinking a repository that recommends running filter-branch and then cloning to leave behind the cruft.

Cloning with a filesystem path makes hardlinks, so use a URL:

$ git clone file:///home/gbacon/src/dBTools.git

Even after doing this, some big unnamed blobs had survived the clone. Thanks to #git on freenode for the suggestion to excise the reflog:

$ git reflog expire --verbose --expire=0 --all
$ git gc --prune=0
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号