I wish to rebuild/rebase all commits in a Git branch X using a source code formatting tool like go fmt or indent.
I'd expect the workflow to roughly consist of making a new branch off master and iterating the following with $_ ranging over the commits in X:
git cherry-pick $_
go fmt ...
git commit -a --amend
Or maybe even
git cherry-pick -n $_
go fmt ...
git cherry-pick --continue
I wouldn't expect -n and --continue to play together like that, though. Also, one should naturally do a go fmt commit to X and go diff X new when done.
However, there are many steps that can go wrong with this procedure, like the -a seeking to change files that weren't changed in the original commit, go fmt confusing Git's patching, Git changing the commit dates, etc.
None of that is particularly troublesome, but if a quick tool or simpler workflow does this more cleanly, then I'd love to know about it.