35

I'm working with Visual Studio 2013 Update 4 and git (hosted on Visual Studio Online). I have 2 local commits and 2 commits in remote branch. There are NO local changes to commit:

Working directory clean

When I try to do Pull (or Fetch) in Visual Studio, I get error:

An error occurred. Detailed message: 1 conflict prevents checkout

An error occurred. Detailed message: 1 conflict prevents checkout

Yes, there is a conflict, I should do merge. And according to this page I should be offered a link to resolve conflict. But I don't see that in VS.

I can do merge outside of VS, but that's not the point. At the same time, my workmate running the same set up can do the merge with no issues. What is wrong with my VS?

p.s. I have msysgit installed that might have messed with configurations. According to this post my global .gitconfig looks like:

[user]
    mail = trailmax@stackoverflow.com
    name = trailmax
    email = trailmax@stackoverflow.com
[core]
    excludesfile = C:\\Users\\trailmax\\Documents\\gitignore_global.txt
    autocrlf = true
    editor = \"C:/Program Files (x86)/GitExtensions/GitExtensions.exe\" fileeditor
[diff]
    tool = vsdiffmerge    
[difftool "vsdiffmerge"]
    cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
    keepbackup = false
    trustexistcode = true
[merge]
    tool = vsdiffmerge
[mergetool]
    prompt = true
[mergetool "vsdiffmerge"]
    cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m
    keepbackup = false
    trustexistcode = true
[credential]
Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
trailmax
  • 34,305
  • 22
  • 140
  • 234
  • Just in case, you you check if the conflicts persists (in a new cloned repo) after a `git config --global core.autocrlf false`? – VonC Dec 13 '14 at 11:27

5 Answers5

57

In my case I could not see the Resolve the conflicts option because I had local changes not committed yet and I was trying to sync with the remote changes. As soon as I committed my local changes and then tried a sync again, Resolve the conflicts link appeared.

So the point here is: commit your changes first and then try to sync. A merge will start and Visual Studio will allow you to go through each of the conflicts.

enter image description here

Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
  • 1
    My issue happened when I had no local changes to commit - everything is commited. That is stated in the second line of the question with the screenshot to prove. – trailmax Feb 25 '15 at 14:03
  • 3
    Yep... I saw that but decided to post this answer here just in case someone like me arrives at your question. Maybe they're facing the same issue and don't know how to get around it. This was the only question that Google returned to me. :) Thanks for the downvote. It really helps. – Leniel Maccaferri Feb 25 '15 at 14:08
  • 1
    in that case put this in your answer, as looks like you have not read the question. And I'll take off the down-vote. – trailmax Feb 25 '15 at 14:09
  • And don't need to be bitter about the down-vote - it's all virtual points meaning nothing. – trailmax Feb 25 '15 at 14:10
  • 1
    I had excluded a handful of changes I didn't want to commit previously and those were sitting on the sidelines preventing the update after the pull. I reverted those files and it updated fine. I guess those count as uncomitted local changes – Darren Mar 18 '15 at 21:54
  • 1
    'Uncommitted Changes' also constitutes files that have _not_ been added to the project, but still have conflicts with the incoming pull. Therefore those conflicting files need to be added to the project before that `Resolve the conflicts` link will display. In my case some files I added to the project where _not_ added via Git and had to go back and be added explicitly. The link then was displayed after committing the missing files. – atconway Aug 21 '15 at 03:53
  • After committing locally I am getting resolve the conflicts link. – nbi Dec 01 '16 at 11:05
12

I have encountered the same issue where "An error occurred. Detailed message: 1 conflict prevents checkout" is shown where there's no option to resolve the conflict as shown in Leinel's answer.

The reason was due to an untracked file that is the same file that is to be pulled. I just deleted the untracked file and retried the pull.

Karlo Medallo
  • 672
  • 7
  • 17
6

I had the same issue. It turns out that I had an untracked file that needed to be included. Therefore, check in Changes tab for untracked files.

azuneca
  • 1,053
  • 13
  • 15
4

I did not have any "Changes" (untracked or otherwise) listed on either branch, so the other answers did not work for me.

I decided to go command line:

  1. Click Sync on both branches.
  2. Switch to the branch you want to "merge into" (master in my case).
  3. In Team Explorer under Manage Branches, do Action -> Open Command Line.
  4. In the command line type git merge BRANCH_NAME. (my work branch / merge "from")
  5. Now the Resolve the conflicts button is available.
Jess
  • 23,901
  • 21
  • 124
  • 145
  • 1
    This is the only solution that tells you which file is in conflict! – kristianp Feb 24 '16 at 00:02
  • 1
    Basically, don't use VS. – Ernesto Dec 20 '16 at 22:46
  • @Ernesto, this might have been a bug, but I've found that learning to use Team Explorer with git does everything I need to do. It is very rare cases like this bug that I have to use the command line. – Jess Mar 22 '17 at 12:45
  • 1
    @Jess, most of the time it works, I agree, but I would rater have it work consistently. Now when this issues where Team Explorer doesn't interact well with git happen, at least I save some time by trying the command line first. – Ernesto Mar 22 '17 at 15:21
1

If the conflicts during the pull are about end of line charaters:

git config --global core.autocrlf false

That should avoid any automatic eol conversion.

You can see more in "Why does git think each line of an untouched file has changed" how to detect that situation in the working tree (git diff --word-diff-regex=.).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • VS did not seem to have a problem with end of line. But that fixed the issue – trailmax Dec 13 '14 at 11:55
  • @trailmax ok. I mention eol because `core.autocrlf` is all about eol. I always keep it at false: http://stackoverflow.com/a/2354278/6309 – VonC Dec 13 '14 at 11:57
  • Yep, done another test (got other user to do conflicting commit) and all worked out. Thanks! – trailmax Dec 13 '14 at 12:14
  • Nope -( sorry. My mate checked in and now I can't pull his changes. But I can merge my own check-ins from other PC. On trying to Pull I still get the same error message: http://i.imgur.com/lTBO57R.png My local repo is clean, even no commits. `core.autocrlf` is set to `false` on my machine. – trailmax Dec 13 '14 at 17:11
  • but I pulled the changes with no conflicts through third party SourceTree application. No issues with git workings. Just VS is bogus -( – trailmax Dec 13 '14 at 17:16
  • @trailmax I suspect a bug ins the Git plugin for VS indeed. – VonC Dec 13 '14 at 17:18
  • Yep, I suspect one too. However I'm trying to replicate the same issue on other machine where I don't have stand-along git installed. I have a suspicion that my local set up is interfering with VS-workings. – trailmax Dec 13 '14 at 17:26