문제

Here is my situation:

I have a git repository with the following layout

myrepo/
myrepo/index
myrepo/data/data01
myrepo/data/data02
myrepo/data/data03
...

I have a few hundred commits, each of which alters the index file and adds one data file. Now, the repository has become pretty big and I would like to get rid of the data files completely, not just removing them from my head but also from the metadata, thus reducing the acutal size of the repository. But I would like to do so, preserving the remaining parts of my commits (the alterations of the index while done along with adding the data). Is that possible?

도움이 되었습니까?

해결책

I found the answer myself on github. Here are the neccesary commands:

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch data/*' --prune-empty --tag-name-filter cat -- --all
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top