Last active
June 11, 2018 10:23
-
-
Save vijayrawatsan/fa498e01d5410867af6730da430e05bd to your computer and use it in GitHub Desktop.
Locally merge pull request
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
# clean repo of any unstaged, uncomiited data | |
cd {repoPath} && git reset --hard && git clean -d -x -f | |
# fetch all remote branches | |
cd {repoPath} && git fetch --all | |
# fetch pr head from remote and create a new branch named {prNumber}-{uuid}, you can generate any uuid lib or simply use date.getTime() | |
cd {repoPath} && git fetch origin pull/{prNumber}/head:{prNumber}-{uuid} | |
# checkout baseRef of the Pull Request | |
cd {repoPath} && git checkout {baseRef} | |
# fetch and merge remote data | |
cd {repoPath} && git pull origin {baseRef} | |
# create new branch from refreshed baseRef | |
cd {repoPath} && git checkout -b {baseRef}-{uuid} | |
# merge {prNumber}-{uuid} into {baseRef}-{uuid} | |
cd {repoPath} && git merge {prNumber}-{uuid} | |
# build code. This part may vary depending on the project structure and build tools | |
cd {repoPath} && mvn clean install -DskipTests | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment