git-filter-repo
git-filter-repo copied to clipboard
Apply a gentler --force
Right now, the sanity checks are all-or-nothing. However, there's one documented use case that forces the use of --force, which is obviously not desirable.
To truncate history we need to do 'git replace --graft new_root'. This leaves the repo in an "unpacked" state. (We also need to remove references that do not have our new root as ancestor, e.g.:
git for-each-ref --no-contains=$FIRST --format='%(refname)' | xargs -n 1 git update-ref -d
)
Rather than bypass all checks, it would be better to have a flag that accepts new update refs and an unpacked state.
Alternatively, the documentation could suggest doing:
git pack-refs
git gc --prune=now
and then supplying a suitable value for --replace-refs (so there are arguments)