I really dislike to have monster .git folder (2GB) and I don't care about changes in 2002 and I don't want to create new repository so what should I do to clean .git / log ?
Note that I want it not local-only, next time I want to clone repository without history or with history since 2011 year.
thank you
From your question, I think you want something like this.
git-rebase(1) does exactly that.
$ git rebase -i HEAD~5
git awsome-ness contains an example.
- Don't use
git-rebase
on public (remote) commits.- Make sure your working directory is clean (
commit
orstash
your current changes).- Run the above command. It launches your
$EDITOR
.- Replace
pick
beforeC
andD
bysquash
. It will meld C and D into B. If you want to delete a commit then just delete its line.If you are lost, type:
$ git rebase --abort
However, to copmress the .git folder safely, the above is not recommended. You can try the following as mentioned in a comment by Linus.
git repack -a -d --depth=250 --window=250
where that depth thing is just about how deep the delta chains can be (make them longer for old history - it's worth the space overhead), and the window thing is about how big an object window we want each delta candidate to scan.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With