"Conflicts prevent checkout" error using Git in Visual Studio

66,623

Solution 1

I have solved the same problem by using the Git command prompt in Visual Studio, because it gives you more ability:

http://msdn.microsoft.com/en-us/library/vstudio/dd286572.aspx

You also may install this extension to facilitate the work with it (it gives you ability do not enter passwords each time):

http://gitcredentialstore.codeplex.com/

Then I used this commands:

git pull // I got an error on this step
git stash
git pull

more information about commands here:

http://git-scm.com/docs/git-pull

http://git-scm.com/book/en/Git-Tools-Stashing

http://git-scm.com/docs/git-commit

And as CharlesB said it is due to "conflict between your changes and the changes from another branch".

Solution 2

You have some uncommited changes. Commit or undo those changes and then Git "pull" will work.

Solution 3

I experienced this issue during a "pull" request via Visual Studio.

There was a change to a hidden file: .ntvs_analysis.dat

To discover this hidden file and remedy the problem, I:

  1. Showed hidden files just to see if there were changes to files that I could not see.
  2. In the project directory, used Git GUI to undo the change to the hidden file that I found.

After that, my "pull" request was successful.


Control Panel => Folder Options => View => Show hidden files and folders

Solution 4

I had this issue and the way I resolved it was by "brute force"...I had no changes to commit, and no commits to sync but still got this error while trying to pull in some changes that another developer pushed.

I ended up just whacking my local repo in the file system and re-cloning the remote branch. Voila!

Perhaps not the most elegant solution, but it works if you don't have any local changes that you are worried about losing.

Share:
66,623
Jim Blum
Author by

Jim Blum

Updated on July 05, 2022

Comments

  • Jim Blum
    Jim Blum almost 2 years

    I am using Git in Visual Studio. When I am trying to synchronize, the following message appears:

    An error occured. Detailed message: An error was raised by libgit2. Cetegory = checkout(MergeConflict). 1 conflicts prevent checkout

    I don't have a clue about what the conflicts are and how to fix them. Can anyone help me overcome this problem?

  • Highmastdon
    Highmastdon over 9 years
    Okay, what you actually do is just moving your open changes to another 'stash' to continue afterwards from it. Please mind this while you do. Another option would be to undo all your pending changes (which are not excluded)
  • gwenzek
    gwenzek over 8 years
    If you're interested in solving this from Visual Studio instead of doing it from the command line, please upvote: visualstudio.uservoice.com/forums/121579-visual-studio-2015/‌​…
  • Caverman
    Caverman over 2 years
    I couldn't see any issue in Visual Studio. VS said all my files were up to date but I couldn't switch to a branch. Used the command line to try to check out the branch and it told me there was a conflict with the .suo file. I used command line to stash that file and then it let me switch branches.