Last active
January 27, 2022 17:15
-
-
Save tw3/494eca55f8d8968dd242a3bdbbe1c2fd to your computer and use it in GitHub Desktop.
Git Bash "script" (for Windows OS) to modify commit messages in bulk, e.g. if you made a bunch of commits listing one ticket id, then decided to create a sub-task ticket and need to update your commits to use that id instead
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
main() { | |
echo "Here's an example:" | |
echo "" | |
echo "\"C:/Program Files/Python39/python.exe\" c:/bin/git-filter-repo.py --commit-callback '" | |
echo "msg = commit.message.decode(\"utf-8\")" | |
echo "newmsg = msg.replace(\"TEXT_FROM\", \"TEXT_TO\")" | |
echo "commit.message = newmsg.encode(\"utf-8\")" | |
echo "' --force --refs pilot..BRANCH_NAME" | |
echo "" | |
echo "1) Copy that into an editor" | |
echo "2) Change TEXT_FROM and TEXT_TO and BRANCH_NAME" | |
echo "3) Run it in your shell :)" | |
echo "" | |
echo "For more details visit: https://stackoverflow.com/a/62458610" | |
} | |
main "${@}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can find download
git-filter-repo.py
here:https://github.com/newren/git-filter-repo/blob/main/git-filter-repo
Of course you may need to update the path to python on your machine