Hyperian
Hyperian

Reputation: 139

Visual Studio 2015 with github plugin issue

I'm new to using github with visual studio 2015 plugin and I'm stuck.

I created a new project on github and was able to link the depot to my visual studio project. I was able to sync some code up to the depot. Then I added a readme file to my project on github from the website. Next day I made more code and decided to sync it up to the depot, but now it says that I have incoming commits (the readme file). I clicked on fetch on the incoming commit but nothing happens. I clicked on pull and it says my changes would be overwritten by merge.

I then went to outgoing commit (the ones i just made) and click on push. it says that "You cannot push branch master to remote origin because there are new commits in the remote repository’s branch. Pushing this branch would result in a non-fast-forward update on the branch in the remote repository"

i click on several things and i still can't resolve this issue. I want to update my current project with the readme and then update my depot. (i also am new to the terminology)

Upvotes: 0

Views: 4434

Answers (1)

GregHNZ
GregHNZ

Reputation: 8969

The trouble is that you've got changes on the server, that are committed, and changes to some of the same files on your local copy that conflict with it to the extent that Git can't figure out which ones should "win".

You'll have to look at each file that has conflicts, understand where the conflicts are, sort them out, tell git that you've sorted out the file, and then progress.

So Fetch will bring all of the changes down from github, locally, but not change your working copy.

Merge is intended to pull down the changes in your current branch and merge them in (and that's where it's having trouble).

Best recommendation for working with git (whether Visual Studio or not)): Fetch and merge often. Every day at least.

This page looks like a reasonable tutorial on how to do it. It looks similar to my VS2015 git plugins.

https://msdn.microsoft.com/en-us/library/dd286559.aspx

This page is quite a good tutorial on doing it from the command line:

https://easyengine.io/tutorials/git/git-resolve-merge-conflicts/

(But I've got to say: the Visual Studio tool makes it easier).

So the key points are:

  • look at each file and fix the conflicts.
  • tell git that you've fixed the file
  • Once you've done all the files, you need to "commit the merge"

Then you're in a place to commit your local changes and push them up to the server.

Second tip: Most people that I know who use git with visual studio also use the command line client extensively, and usually have an additional gui client (such as Atlassian's Sourcetree) as well. I use all three every day.

Upvotes: 2

Related Questions