Tuesday, January 02, 2018

Git merge moved folders

Short version: make a patch, change paths, apply patch, resolve merge conflicts, done.

Commands:
# git checkout master
# git pull
# git checkout mastertfs
# git pull
# git tfs pull
# git format-patch `git merge-base mastertfs master` --stdout > ../latest.patch
# script-to-change-paths--see-below ../latest.patch
# git checkout master
# git merge -s ours mastertfs --no-commit
# git apply ../latest.patch --ignore-space-change --ignore-whitespace --3way --whitespace=fix
# git commit -m "merge from tfs"
# git push origin master mastertfs

sed --in-place --expression 's|Modules/19.0/main/AAA/|Modules/AAA/src/|g' $1
sed --in-place --expression 's|Modules/19.0/main/BBB/|Modules/BBB/src/|g' $1
sed --in-place --expression 's|Modules/19.0/main/CCC/|Modules/CCC/src/|g' $1

No comments: