Created
July 5, 2016 13:24
-
-
Save pathikrit/d77a2873b8590fc10b8865008e790790 to your computer and use it in GitHub Desktop.
Script to replace a substring in all new commit messages in your feature branch
This file contains 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 | |
substring=$1 | |
replace=$2 | |
current_branch=$(git name-rev --name-only HEAD) | |
echo "Replacing ${substring} with ${replace} in all new commits in ${current_branch}" | |
cd $(git root) | |
git filter-branch --msg-filter "'sed ""s/${substring}/${replace}/g""'" master..${current_branch} | |
git push -f | |
cd - | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment