I have a bare git repository with some loose objects. How do I pack all loose obects into a single, new pack, without changing other packs?
3 Answers
git pack-objects < object_list.txt
where object_list.txt has a list of object hashes, delimited by '\n'.
-
Thank you for the suggestion, it was useful for me to solve the problem. I can't accept, because it doesn't solve the problem end-to-end.– ptsCommented Sep 9, 2013 at 22:20
I could come up with:
$ git prune-packed
$ find objects/?? -type f | perl -pe 's@^objects/(..)/@$1@' |
git pack-objects objects/pack/pack
$ git prune-packed
Is there anything simpler?
Warning, when using git prune-packed
.
Before Git 2.22 (Q1 2019), "git prune-packed
" did not notice and complain against excess
arguments given from the command line, which now it does.
See commit 9b0bd87 (11 Feb 2019) by Ramsay Jones (jeffhostetler
).
(Merged by Junio C Hamano -- gitster
-- in commit ebf846c, 07 Mar 2019)
It will now display "too many arguments
" if any argument is passed to git prune-packed
.
-
1