Can you merge two branches in Visual Studio Online?

4k views Asked by At

At the moment, from what I know, if you have two branches, you have to have both branches mapped to locations on your machine and Visual Studio (or TFS within Visual Studio) will download the latest version and merge the changes locally and then you have to check in the other branch. I would like to be able to merge this branch with this branch with only having one branch mapped locally?

The purpose of this is that we have a development branch, a test branch and a release branch and we are merging changes from the development branch into the test branch and building it on the server which is then deploying it on another server. All this is working great but the test (and release) branch must be mapped on the machine of anyone trying to do this otherwise it won't work.

Ideally I'd like to be able to log into Visual Studio Online and do all the merges, builds and deployments there rather than on my development machine at all - is any of this possible? And if so, how please?

1

There are 1 answers

1
d3r3kk On

Not entirely sure this is something support-able by the TFS product, actually. Merges tend to need at least a minimal amount of human interaction whenever there is conflicts (and even in the cleanest merge relationships conflicts can and do arise).

However, you can do this on the build machines if you wish by performing the merge just before the build occurs and if the build succeeds, checking the merged changeset in.

Using the Pre- and Post- build script functionality in TFS build, you could try to do something such as the following...

Pre-build script would include commands such as:

tf merge $/ProjectRoot/Branches/Dev $/ProjectRoot/Branches/Test
tf resolve $/ProjectRoot/Branches/Test /r /i /auto:TakeTheirs

Post-build script would include:

tf checkin $/ProjectRoot/Branches/Test /r /i /comment:"***NO_CI*** [AutoMerge]"