diff --git a/tests/travis/initiate_ui_tests.sh b/tests/travis/initiate_ui_tests.sh
index 3278e51724aab89df1bf9bf4fd5e447394879f0e..7a8aa9b2c2b6899752d16f2550bf878a7ac8634b 100755
--- a/tests/travis/initiate_ui_tests.sh
+++ b/tests/travis/initiate_ui_tests.sh
@@ -18,8 +18,9 @@ COMMIT_MESSAGE=$(git log "$TRAVIS_COMMIT" -1 --pretty=%B)
 
 cd tests/PHPUnit/UI
 
-git checkout master
-git pull --rebase origin master
+UI_BRANCH=`git rev-parse --abbrev-ref HEAD`
+git checkout $UI_BRANCH
+git pull --rebase origin $UI_BRANCH
 
 echo "$TRAVIS_COMMIT
 $TRAVIS_BRANCH" > piwik_commit.txt
@@ -31,7 +32,7 @@ git add ./piwik_commit.txt
 git commit -m "Travis: Initiating build for commit '$TRAVIS_COMMIT' on branch '$TRAVIS_BRANCH': $COMMIT_MESSAGE"
 git remote set-url origin "https://piwik-auto-commit-bot:$PIWIK_AUTOMATION@github.com/piwik/piwik-ui-tests.git"
 
-if ! git push origin master 2> /dev/null; then
+if ! git push origin $UI_BRANCH 2> /dev/null; then
     echo "Failed to push!"
     exit 1
 fi
\ No newline at end of file