0

lets say I have a huge PR and I want to do some automatic rewrite of some of the commit messages.

Pretty sure there is a way to automate git-rebase to run commands for every commit (for example to sign/re-sign) but I like the git commit --fixup amend:hash model as I would be able to review and drop if i don't like the result (without deep reflog dive)

when I try -F/--file with --fixup I get this error:

$ git commit --fixup amend:21d53a765cf8925ffcdae9199dde4e96760be974 -F /tmp/z
fatal: options '-F' and '--fixup' cannot be used together

Now I get it - the first line needs to be amend! <exact-original-first-line> and sure I can write a script and set GIT_EDITOR to that script (and what I intend to try) but -is there no cleaner way?

nhed
  • 5,774
  • 3
  • 30
  • 44
  • 1
    What do you want to do? `git rebase -x` sounds like a good idea – knittl Oct 14 '22 at 20:30
  • @knittl yeah that's what I was thinking about when I said "for example to sign/re-sign" but I would like to have the ammend commits to manually review before rewriting history – nhed Oct 14 '22 at 20:36
  • 1
    There isn't today. Feature requests for future Git releases belong on the Git mailing list. Warning: some people on the list like to argue, so be prepared to discuss why your way is the Best Way. :-) – torek Oct 14 '22 at 21:16
  • @torek I can imagine - for me I solved with a bash script with two functions one to detect which commits to amend and one to serve as the editor (locate the info I want in there, then `sed -i "s#${ogcommit}#${resolvedcomit}#" ${1}` ... when script called with a file i just invoke the editor function. Its just a tad convoluted solution IMO – nhed Oct 14 '22 at 21:23

0 Answers0