I want to backup a Git versioned project, including the working directory changes, and a pointer to the remote repository.
The backed-up folder should contain the working directory files, and needed .git files in order to allow the user to navigate to the project and run git pull
(or another git command) safely. It doesn't matter if the remote directory needs to be downloaded again and check "integrity" with the working directory.
I can't backup the whole .git folder, as it contains very large files.
I tried these commands:
git --aggressive
git reflog expire --expire=now --all
git repack -ad
git prune
But they still leave large (>200 MB) *.pack
files in .git/objects/pack
folder.
- I tried removing the
objects
folder but that makes the repository invalid:fatal: Not a git repository (or any of the parent directories): .git
.- I tried
git init
after removingobjects
folder, but that gives the errorfatal: bad object HEAD
, and I can't do any other command.
- I tried
- I tried removing all files and folders inside
.git
, except for.git/config
, and it's still not a valid git repository.- I tried
git init
after removing those folders, but then the changes on the working directory become "untracked", even though they are the same files on the remote repository, so I'm forced to rungit clean -fd
and download the repository again.
- I tried
Is there a way to create a bare bones Git repository, with minimum pack files, while maintaining the "tracked" status of the working directory?