Visual Studio 2013 Github commit deadlock

前端 未结 11 1924
花落未央
花落未央 2021-02-05 01:23

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

相关标签:
11条回答
  • 2021-02-05 01:52

    Same thing was happening to me, I committed all my changes and get the same error when I try to switch branches.

    I realized there was one file I chose to "ignore" which I left under the "Excluded Changes". Apparently, VS2013 is not properly handling this exclusions well.

    So after many tries I came up with a simple solution:

    1. I moved the file to ignore from "Excluded Changes" to the "Included Changes";
    2. I made a local commit;
    3. Switched branch without problem;
    0 讨论(0)
  • 2021-02-05 01:55

    Visual Studio 2013 seems to be lacking maturity as a GIT UI. I ran across similar issue even after having committed all my changes locally. For errors arising from Push & Pull in Visual Studio 2013, I would recommend using Git Bash to do a git pull command. The command-line pull command is much more powerful than VS UI and will overcome some issues.

    In response to Walter Schultz, you are getting the error because you seem to be trying to keep binary & assembly files (dll and exe's) in version control. Binary files are not editable & not mergeable, thus they should not be included in version control.

    In order to exclude these files from the GIT repository, you can create a .gitignore file and include following items:

    --- begin .gitignore file ----------------
    ## Ignore Visual Studio temporary files, build results, and
    ## files generated by popular Visual Studio add-ons.
    
    # User-specific files
    *.suo
    *.user
    *.sln.docstates
    *.cache
    
    # Build results
    [Dd]ebug/
    [Dd]ebugPublic/
    [Rr]elease/
    x64/
    build/
    bld/
    [Bb]in/
    [Oo]bj/
    Dev/
    bin/
    --- end gitignore file ----------------
    

    Once you create the .gitignore file, go into your local repository and delete all files in your /Bin/ folder and other files that you do not wish to keep track of.
    Then push to local & sync your code to server repository.
    Hope this helps.

    0 讨论(0)
  • 2021-02-05 01:58

    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.

    0 讨论(0)
  • 2021-02-05 02:03

    I didn't had uncommit changes, still had the same error when performing the merge to develop. I tried:

    1. git status, and then
    2. git pull

    And then tried the merge to develop again and the error does not show up anymore. I had to solve some conflicts though. I can image that only the second command is really relevant but I have no clue what is happening here so I rather document all the steps.

    0 讨论(0)
  • 2021-02-05 02:05

    I was having this problem in VS 2015 and the only thing that fixed it was restarting VS. None of the other situations mentioned above were applicable.

    0 讨论(0)
提交回复
热议问题