I've trying to do a setup, where I use Travis CI (http://www.travis-ci.org) to build and test my program each time I commit to GitHub. My GitHub setup is to have a master and a slave/test branch, which I commit to before merging into master. However, as of right now I'm doing the merging manually on GitHub.com, which I could like to automate, such that when a build is successful on Travis, I want to merge my slave/test branch into the master right away. Does anybody know how this is possible on Travis CI or another way of achieving this with Travis?
First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch.
Merging Branches At the top right of the Source Control panel, there is a button with an ellipses (…). If you want to merge two branches together, you can just click this button, go to the 'Pull, Push' option, then select 'Pull from…' and select a branch to merge with.
Actually yes you totally can, when you merge again it will bring over any commits that don't exist on production.
You can prepare script which will use for merge your branches. Travis set some useful environment variables which you can use in your script.
Merge script can look like:
if [ "$TRAVIS_BRANCH" != "test" ]; then
exit 0;
fi
export GIT_COMMITTER_EMAIL=...
export GIT_COMMITTER_NAME=...
git checkout master || exit
git merge "$TRAVIS_COMMIT" || exit
git push ... # here need some authorization and url
Next you can put in .travis.yml
after_success: ./merge_script.sh
More info:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With