Last active
September 6, 2022 09:40
-
-
Save AkselMeola/05794b191ccd862cfcb13f2b2fea3b9d to your computer and use it in GitHub Desktop.
Template merge PR command
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
# It expects that you have github client. If not just remove ther "gh pr .." line. | |
# It expects bash. Not sure how it will work on other shells. | |
# It expects the current folder to be same as the calc worker repo name e.g. "qmt-poland-motor-link4" | |
# If merge fails you need to solve them manually. | |
BRANCH="feature/updates-merge-from-template" && \ | |
git checkout master; git fetch --all && \ | |
git pull && \ | |
git fetch template && \ | |
git checkout -b $BRANCH && \ | |
git status && \ | |
git merge template/master --no-edit && \ | |
find ! -path '*/vendor/*' -name '*.go' -exec sed -i "s/qmt-worker/"$(basename "$PWD")"/g" {} + && \ | |
go mod vendor && \ | |
make test && \ | |
git diff --quiet && git diff --staged --quiet || git commit -a -m "Updates from template" && \ | |
git push --set-upstream origin $BRANCH && \ | |
gh pr create --fill --base master --repo "Insly/"$(basename "$PWD") && \ | |
exo-open "https://github.com/Insly/"$(basename "$PWD") | |
# If known conflicts then merge command can take an extra argument `--strategy-option theirs` which would accept template chnages. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment