Created
January 27, 2025 18:41
-
-
Save tw3/5d836187313811d382e6ded56aa1c86b to your computer and use it in GitHub Desktop.
Bulk replace text, (e.g. a jira ticket id) in all commits in a feature branch off of master
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
FROM_TEXT=CX-133209 | |
TO_TEXT=CX-136414 | |
FEAT_BRANCH_NAME=cx-136414 | |
BASE_BRANCH_NAME=master | |
"C:/Program Files/Python312/python.exe" git-filter-repo.py --commit-callback ' | |
msg = commit.message.decode("utf-8") | |
newmsg = msg.replace("${FROM_TEXT}", "${TO_TEXT}") | |
commit.message = newmsg.encode("utf-8") | |
' --force --refs ${BASE_BRANCH_NAME}..${FEAT_BRANCH_NAME} | |
## git-filter-repo.py can be downloaded locally here: https://github.com/OPSWAT/endpointsecsdk/blob/main/git-filter-repo.py | |
## You may need to use Python v3.12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment