Created
July 5, 2021 21:46
-
-
Save torian257x/aac316d9115b04981a4dbf7f4fbc920b to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# $1 - file name | |
# $2 - string to find | |
# $3 - string to replace | |
git filter-branch -f --tree-filter "if [ -f $1 ];then sed -i s/$2/$3/g $1;fi" |
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
#!/bin/bash | |
# $1 - string to find | |
# $2 - branch name or nothing (current branch in that case) | |
git log -S "$1" $2 --name-only --pretty=format: -- | sort -u |
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
#!/bin/bash | |
# $1 - branch | |
# $2 - string to find | |
# $3 - string to replace with | |
git checkout $1 | |
for file in $(~/findFilesContainingStringInBranch.sh "$2"); do | |
echo " Filtering file $file:" | |
~/changeStringsInFileInCurrentBranch.sh "$file" "$2" "$3" | |
done |
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
#!/bin/bash | |
# $1 - string to find | |
# $2 - string to replace with | |
for branch in $(git branch | cut -c 3-); do | |
echo "" | |
echo ">>> Replacing strings in branch $branch:" | |
echo "" | |
~/replaceStringInBranch.sh "$branch" "$1" "$2" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment