Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

Resolve Git conflicts

Visual Studio 2013

A major advantage to developing an app under version control is that many people can concurrently modify many different versions of the same codebase at the same time. However, this means that sometimes you must resolve conflicts before you can pull changes from the remote repository, or before you merge two branches. Even though conflicts can be frustrating, Visual Studio provides tools to help you resolve them.

For example, Raisa wants to push a change to a file. If any commits have been pushed since her last pull, she must pull them down before she can push her commit.

Fetch link on Commits page

She can view details about the incoming commit from Jamal and see that he has modified the same line of code that she modified.

Commit details

When she tries to pull, Visual Studio shows her the conflict.

Conflicts sometimes occur when you try to pull

Content conflicts are the most common type of conflict. In most cases, the Merge window is the easiest way to resolve a content conflict.

Using the Merge window to resolve a conflict
  1. Open the merge window.

  2. Select neither, one, or both of the check boxes on either side of the conflict to pull that content into the resolution.

  3. You can add code directly to the resolution if you need to.

  4. To move quickly among conflicts, choose Next Conflict (Keyboard: F9) or Previous Conflict (Keyboard: Shift + F9).

  5. When you are satisfied with the resolution, accept it.

After you have resolved all the conflicts:

Commit Merge button on Resolve Conflicts page
  1. You can commit the merge.

  2. Or, if you cannot resolve all the conflicts (for example, if you don’t have the time or the information you need to proceed), you can undo all your resolutions.

If you decide to commit to the merge:

The Changes page with merge change ready to commit

After you commit, you then push your changes into the remote repository in your team project.

Pushing the commits
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.