Hi Tim, On Tue, 9 Dec 2025 19:48:06 +0000 (GMT) Tim Woodall <[email protected]> wrote:
> I want to rewrite git history from the very first commit (which is an > empty commit) but nothing I can find seems to let me do this other > than with manual intervention. > > This is a one off and doesn't need to be efficient so long as I can > leave it to get on with it without intervention. The built-in way to do this is to use `git filter-branch`. There are a number of examples on the git-filter-branch man page, and it looks like a combination of the --tree-filter and --env-filter arguments would make the modifications you want. It's probably a good idea to take a backup of the repo before attempting anything with this. I haven't needed to use it myself, I'm just aware it exists. > This is what I have: (private-email is a place holder) > > === > #!/bin/bash > > for commit in $( git rev-list --all --reverse master ); do > git cherry-pick --strategy-option=theirs $commit > > echo "running sed" > sed -i 's/[email protected]/[email protected]/g' $( > git grep -l '[email protected]' ) > > GIT_AUTHOR_DATE="$(git show -s --format=%ad HEAD)" > GIT_COMMITTER_DATE="$(git show -s --format=%ad HEAD)" git commit -a > --amend --reset-author --no-edit --allow-empty done === > > and this runs for a while but then gets stuck due to a merge conflict > (which I thought --strategy-option=theirs would automatically fix) > > === > Does anyone know of a way to do this? I'm expecting it to take a long > time hence why I don't want to have to do manual intervention Cheers, Bryan

