How to make commit-message/loop counter work correctly, with git filter-repo --commit-callback ? #439
Unanswered
marfeljoergsen
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have previously used git filter-branch - but understand it's deprecated and I should instead use git-filter-repo. I usually have a bunch of commits and when I'm done I would like to prepend the first line of the commit-message with a ticket-number and I would often like to append a counter telling which commit this is out of how many commits in total there are. I made a small bash-script:
Save the above as e.g. /tmp/addComm and "chmod +x" on this file. It's used like this (first prepend the ticket number, next use the special "?/?" syntax, which should be replaced):
PREPEND="#1234: " APPEND=" (?/?)" /tmp/addComm "HEAD~4..HEAD"
It mostly works - except the commit-number counter:
Only the first (1/4) is correct, the remaining is wrong. The correct result should be with increasing counter:
My question is: How do I make the commit-counter work properly (with increasing commit-counter out of the total number of commits)? hmm... I guess a work-around is to make a loop inside the script and let "RANGE" be a single commit in the whole range of commits - so instead of calling "git filter-repo --commit-callback" on a range, I would have to call it for every commit in the loop... Maybe that's the only solution, to fix my counter-issue? hmm... Appreciate any feedback/ideas...
Beta Was this translation helpful? Give feedback.
All reactions