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 --aggressivegit reflog expire --expire=now --allgit repack -adgit prune
But they still leave large (>200 MB) *.pack files in .git/objects/pack folder.
- I tried removing the
objectsfolder but that makes the repository invalid:fatal: Not a git repository (or any of the parent directories): .git.- I tried
git initafter removingobjectsfolder, 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 initafter 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 -fdand 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?