I have a git repository in a pathological state such that various checks fail with the deviations from the main branch, failures with LFS, and conflicts. However, the head of the repository works fine. I would like to take the current state and start over by making a new repository. How would I export the current head while cutting off the remaining history?
Ideally, I would like to keep the
- Current state of the files
- Keep current LFS files in LFS
- Keep
.gitignore
configuration but disregard history ion.git
folders - Keep submodules as submodules as submodules
I see that git archive
will export but destroys all git structure and I don't expect to end up with a git repository afterwards. A similar question on SO (here) discusses how to archive submodules but I don't want just a raw export, I want the submodules to still be submodules and just keep the head without history. Another question is very similar here but the solution is to rebase and squash but I think I cannot apply all 5156 old commits because some LFS files have been lost.
Is there an easy way to do this? My thought is that I may have to archive then remake the submodules and import the ignores from the old file.