Skip to main content
The 2024 Developer Survey results are live! See the results
10 events
when toggle format what by license comment
Jan 5, 2023 at 15:59 comment added amphetamachine This post (git unpack-objects < SAMPLE/*.pack) made me do a double-take and think I thought I was mistaken all these years about how Bash handles <. Bash cannot use the < operator with multiple files. You must iterate over them one at a time, e.g. for fn in SAMPLE/*.pack; do git unpack-objects < "$fn"; done.
Jan 18, 2021 at 11:32 history edited Wai Ha Lee CC BY-SA 4.0
added 7 characters in body
Aug 9, 2020 at 5:06 comment added Jason @WilsonF You could also run a simple command like for file in $(ls SAMPLE/); do git unpack-objects < SAMPLE/$file; done and achieve your solution.
Jul 3, 2019 at 17:56 comment added Paul Stelian @WilsonF You have multiple or no pack files (probably multiple). You need to actually run the command once for every .pack file, and specify its actual filename (you can use tab-completion for that though)
Apr 13, 2018 at 23:08 comment added Wilson F When I try the command git unpack-objects -n < SAMPLE/*.pack, bash gives me an error: bash: SAMPLE/*.pack: ambiguous redirect. Is it because I'm trying to use the -n switch? I wanted to try a dry run before committing to the full unpack...
Jul 3, 2015 at 16:11 comment added kostix I would also add that there's a file .git/objects/info/packs which appears to list the pack files available under .git/objects/packs. There's also the file .git/packed-refs which contains the list of refs (heads, tags) available via pack files. I'm not sure what to do with them after removing the pack files -- may be they need to be removed, may be git fsck would take care of them -- I dunno. Just something to keep in mind just in case...
Jan 29, 2015 at 12:56 comment added Sam Watkins thanks, just one thing - the pack files do not need to be inside the repo
Aug 26, 2013 at 15:13 comment added Kevin Cox Hacky, but valid. The reason this works is that git unpack-objects won't create objects already in the repo, and seeing as the pack file is in the repo it does nothing. This is very clearly explained in get help unpack-objects.
Jun 7, 2013 at 16:13 vote accept Chico Sokol
Jun 6, 2013 at 21:04 history answered William Seiti Mizuta CC BY-SA 3.0