Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Extension for Visual Studio

I am new to git and I'm using git extension for Visual Studio. When other team members commit changes sometimes when I try to sync the project I can see the incoming commits but the project is not synced and the error below is raised.

An error was raised by libgit2. Category = 21 (MergeConflict). 2 uncommitted changes would be overwritten by merge

the problem is that how can I merge conflicts? There is no window for merging conflicts after this error is raised and I have also committed all my changes.

like image 684
Pooya Yazdani Avatar asked Jun 28 '13 07:06

Pooya Yazdani


1 Answers

The message is about uncommitted changes, not real merge conflicts. Learn to NOT merge or do any fancy git stuff with uncommitted changes. Before an operation commit your changes or stash them. Even if conflict like that is not flagged it's likely not what you really wanted to do.

In GE there's an option to show worktree changes (ignore the "slow" warning unless you work on a giant repo and regularly have hundreds of changed files) and get used to look at it in browse. Also the "Commit" button shows a count, that shall be 0 when you incite a merge.

If in the middle of your work you want to synch (and thought again and have a really good reason, honest), use stash, then pull (or rebase), and after that is done, unstash your work.

Real merge conflicts are best handled using visual merge tools, you can try tortoisemerge, or my favorite, sourcegear's diffmerge. Kdiff3 that is shipped with GE is good to look around but not so good at resolve itself, unless all you need is pick candidates literally. GE puts you to conflict resolution automaticly.

like image 68
Balog Pal Avatar answered Oct 20 '22 17:10

Balog Pal