Created
December 15, 2018 21:17
-
-
Save ostrolucky/993ea7ea8464ea47832ac92e8c7b8388 to your computer and use it in GitHub Desktop.
Apply only changes which are mergeable to upper branch without conflicts
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
UPPERBRANCH=master | |
BOTTOMBRANCH=3.4 | |
DIR="src" | |
git checkout $BOTTOMBRANCH | |
php-cs-fixer fix $DIR --rules='{"array_syntax": {"syntax": "short"}}' | |
git diff > patch.patch && splitpatch patch.patch && rm patch.patch | |
git checkout $UPPERBRANCH --force | |
mkdir -p nonworkingpatches workingpatches && rm -rf nonworkingpatches/* workingpatches/* | |
for patchfile in *.patch*; do | |
patch -s --force -p1 < $patchfile 1>/dev/null | |
if [[ $? -eq 0 ]]; then | |
cp $patchfile workingpatches/ | |
fi | |
rm $patchfile | |
done | |
git checkout --force $BOTTOMBRANCH | |
git clean -fd $DIR | |
git checkout -b array_syntax | |
cat workingpatches/*|patch -s -p1 | |
rm -rf workingpatches | |
git add $DIR | |
git commit -m "Use short array syntax |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment