Search code examples
gitteamcityteamcity-9.0

Authomatic merging on Teamcity


Have a problem. The task is: checkout first_branch, merge into him changes from second_branch, commit and push these changes.

Teamcity VCS root checkouts only first_branch without any information about other branches in the repo. That's why it cannot find second_branch and I receive the message "not something we can merge". Question: how to check out two branches in the same folder using Teamcity? The way to clone all repository using git clone is not appropriate.


Solution

  • If you want to get a single branch, you can just add the remote and then fetch the branch. Cloning is probably the easiest but if you only want the single branch you can do the following steps.

    git remote add -t <branch_name> -f origin https://<repo_address>
    git checkout <branch_name>