vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Git integration fails to see merged file as staged if I reject all incoming edits

Open sandersaares opened this issue 10 years ago • 7 comments

VS Code Version 1.2.1 Commit fe7f407b95b7f78405846188259504b34ef72761 Date 2016-06-14T13:00:22.146Z Shell 0.37.6 Renderer 49.0.2623.75 Node 5.10.0 Windows 10 Enterprise x64, latest non-Insider git version 2.9.0.windows.1

Description: during a Git merge process, VSCode can sometimes show no pending changes and refuse to let me commit, while command-line Git believes a merge is in progress and lets me commit. This occurs if the changed file contains no changes (after merge) that came from the commit that I am merging into my local state.

Steps to Reproduce:

  1. Create Git repository (e.g. on GitHub).
  2. Clone to working folder A.
  3. In working folder A, commit a file with some arbitrary text. Commit and sync
  4. Clone to working folder B.
  5. In working folder B, change some part of the file. Commit and sync.
  6. In working folder A, change some part of the file, conflicting with previous. Commit and sync.

This will result in a merge conflict due to the change from working folder B getting pulled.

Resolve the conflict by removing all changes pulled form working folder B - the file should be the same as the committed state that existed in working folder A. Stage the file to mark the file as resolved.

Expected result: file is staged and VSCode lets you commit the merge.

Actual result: file disappears from Git tab and VSCode says cannot commit as there are no pending changes.

git commit from the command line works fine to finish the merge, only VSCode refuses to cooperate here.

sandersaares avatar Jun 22 '16 09:06 sandersaares

This is a bit unfortunate and a not so common real world case. It happens when:

  • There are no changes other than conflicting changes
  • The conflict resolution for all changes is to take A version

The command line git will create an empty commit, since there is nothing to be done on the merge commit. Code will just not let you do a commit since it doesn't support empty commits.

We should maybe make Code aware that a merge is in progress, thus allowing the completion of the merge to follow.

joaomoreno avatar Jun 22 '16 20:06 joaomoreno

Related to #6403. Fix could be done regarding both.

joaomoreno avatar Jul 06 '16 10:07 joaomoreno

Any update here?

yaroslavsadin avatar Jul 05 '19 00:07 yaroslavsadin

#88034 is probably a duplicate.

quhsi avatar Aug 24 '20 09:08 quhsi

I also recently came across this. I think it's not necessarily a rare thing for beginners who are experimenting with a simple repo and simple conflicts. It is very confusing with the way this just disappears in the UI even though the merge isn't complete.

A fix would be very helpful.

LitKnd avatar Nov 04 '20 16:11 LitKnd

Fixed by adding an action to Create Empty Commit to the notification

joaomoreno avatar Nov 05 '20 10:11 joaomoreno

@joaomoreno this totally works and is clearly a corner case, but its not the most intuitive notification. i wish I could see that I did something with the merge conflicts and create empty commit changes to something like "ignore all incoming merge conflicts". i imagine anything more custom is not trivial so I do not reopen this.

sbatten avatar Dec 03 '20 22:12 sbatten