A few friends and I are working on a project via GitHub. We are all sharing the same branch, which may or may not be a good idea.
I edited some of the code and committed
When using the Visual Studio Git Provider (VS 2013, VS2015), this situation can also arise in scenarios where a local Commit has been performed, but, when attempting to Pull from the server and merge, the error message:
"uncommitted changes would be overwritten by merge"
is still displayed, and the Pull action is cancelled.
This can occur because locally, there are Untracked Files that were not part of the local Commit, but are part of the remote Pull; the merge resolution cannot deal with this scenario.
Typically this occurs when some files such as T4 template outputs are included in a Commit on one workstation, but not on others.
Additionally, this can occur in Visual Studio 2015, when working with MVC6 projects (at time of writing), when files in the wwwroot folder have been included in a Commit on one workstation, but not on another (one possible cause of this is that the .gitignore files are different on the workstations attempting to work with the same server repository).
To resolve:
a) View the Team Explorer > Changes dialogue.
b) Verify that any Untracked Files that actually reside in the server branch are to be included in your Commits; to do this, right-click and select Add. Alternatively, if you intend them to be overwritten, you can select Delete. Please observe caution.
c) Perform a Commit, and then a Pull, and perform any merge conflict resolution that is required.
d) Perform a Push to update your Remote repository.