none
Prevent auto commit from automated Git merge in VS2015

    Question

  • We are having an issue with VS2015 and Git. If two developers make a change to a proj file and then sync, VS2015 is doing an auto-merge which it then automatically stores as a local commit. If there is a conflict, then the developer has the opportunity to choose how to merge the files. If there is no conflict however, the developer is not allowed to be part of the merge process.

    This has caused issues with us because the automated merge has done the job poorly and changes have been lost as a result.

    There appear to be a few options for how to influence. For example:

    • Update gitattributes to change the merge driver for proj files
    • In global/repo settings, uncheck "Commit changes after merge by default"

    Unfortunately none of these have worked and both the auto-merge and auto-commit continue to cause issues.

    Is there anything that can be done to influence this process?

    Monday, January 04, 2016 11:08 PM

All replies

  • Hi Rory Primrose,

    I did a test in my side and the behavior is same to you.

    The merge process will appear only when there is a conflict.

    I have checked the settings in the Visual Studio and I can’t find any settings or options to influence this process.

    I am not quite sure whether there exist some settings or anything else which can influence this process.

    So I will invite some Microsoft senior engineers for further troubleshooting.

    Thanks for your understanding,

    Best Regards,

    Lake Xiao
    Wednesday, January 06, 2016 2:26 AM
    Moderator
  • Hi Rory,

    It's worth for you to have a check on the Merging and csproj files part of this article. Quoted from that article: 

    If you want to always trigger a merge conflict if the csproj has been altered, you can ask Git to treat it as a binary file, by adding this to the .gitattributes file:

    *.csproj  merge=binary

    Additionally, also see the answer reply on this link which discusses the same issue as yours. 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 07, 2016 6:06 AM
    Moderator
  • @Lake, that would be a conflict because the change is on the same line. My issue is where there isn't a conflict and auto-merge can occur.

    @Vicky the default merge driver for csproj is already binary. I have tried union as well but still no joy.

    The issue here is where there are two changes to the same file on different lines. I have been simulating this by doing  sync, then editing a line in program.cs using the VSTS/TFS web UI, then making a local change to a different line on the same file, then doing a pull. VS2015 auto-merges and auto-commits to the local repo.

    Friday, January 08, 2016 1:28 AM