atom / github

:octocat: Git and GitHub integration for Atom
https://github.atom.io
MIT License
1.11k stars 393 forks source link

Cannot merge resolved conflicts #1330

Open Bartozzz opened 6 years ago

Bartozzz commented 6 years ago

Description

I have modified a file and tried to push the change, which resulted in a conflict. Atom is asking me to merge conflicts first, but there's no way to stage changes/resolve the conflict if I use changes from the last local commit. It's quite confusing that the "Use me" button doesn't actually allow me to merge anything.

Steps to Reproduce

  1. Merge conflicts view:

    zrzut ekranu 2018-03-03 o 18 06 05
  2. I clicked on the first "Use me": so package.json matches the local version from the last commit:

    zrzut ekranu 2018-03-03 o 18 06 16
  3. When I try to stage the changes, Atom says that merge markers are still there:

    zrzut ekranu 2018-03-03 o 18 06 57
  4. When I click on "Stage", it would commit the merge markers (unwanted behaviour):

    zrzut ekranu 2018-03-03 o 18 04 30
  5. When I save the file first and then try to stage it, it's impossible because the file hasn't changed since the last commit:

    zrzut ekranu 2018-03-03 o 18 18 45

Expected behavior:

Automatically resolve the conflict when i click on "Use me" or at least be able to stage the file without merge markers.

Versions

Atom     : 1.24.0
Electron : 1.6.16
Chrome   : 56.0.2924.87
Node     : 7.4.0
apm      : 1.18.12
npm      : 3.10.10
node     : 6.9.5 x64
atom     : 1.24.0
python   : 2.7.10
git      : 2.16.1

macOS High Sierra v10.13.3 (17D47)

Bartozzz commented 6 years ago

I was able to resolve the conflict manually via the CLI:

$ git pull
Auto-merging package.json
CONFLICT (content): Merge conflict in package.json
Automatic merge failed; fix conflicts and then commit the result.
$ git add package.json
$ git commit -m "Merged package.json"
[master 319618c] Merged package.json

But it's still impossible to do the equivalent in Atom.

jonkri commented 6 years ago

This is occurring on both Windows and GNU/Linux as well,

JamesCoyle commented 6 years ago

Same issue here. Click to use local version -> Stage the files in the merge conflicts section -> File disappears from the Git panel completely as it matches the local version. Then you're stuck as you can't pull during a merge, can't push without first pulling, and can't commit as there are no staged files to commit. Really frustrating having to fix it manually each time when the UI should handle it correctly.

bgilm commented 6 years ago

This is happening to me too,I found that if you manually select which part of the code you want and eliminate the markers by hand it works

izoniz commented 6 years ago

Same issue. When I click stage changes it's didn't appear at staged panel and commit button not working. From command like works good.

chepo92 commented 5 years ago

Same issue. any workaround or info into solving it?

jonathan3087 commented 5 years ago

In my case, when I got this message, I just needed to save the file in Atom (File>Save) and then I just clicked Stage or Stage All in the Git side panel and the files were staged (as if I typed "git add ." from the CLI). Hope this helps someone.

vldmr1986 commented 5 years ago

This issue reproducible also with VScode and native Terminal (MacOS). Does anyone know how to solve this problem?

kolgrov commented 5 years ago

@jonathan3087's solution works for me. When I get the dialog box "file contains merge markers", I cancel, save the file, stage it, and commit. Works like a charm:)

isaaclubow commented 4 years ago

This is an infuriating problem - when I clean up the file and save it, it still does not permit the merge to proceed. The "solutions" above are nothing more than aborting the operation and trying to work around it - this is inconvenient and error-prone.

mstmustisnt commented 4 years ago
  1. Before staging you have to save the file, if you do, there will be no markers.
  2. If you stage the file but Staged Changes stays empty and Commit to master is disabled, you should conclude the merge manually (this looks like a bug): Open Git Bash in the repository directory and run git commit -m "MErge remote-tracking...."
mstmustisnt commented 4 years ago

if commitIsEnabled function which now looks as follows:

 commitIsEnabled(amend) {
    return !this.props.isCommitting &&
      (amend || this.props.stagedChangesExist) &&
      !this.props.mergeConflictsExist &&
      this.props.lastCommit.isPresent() &&
      (this.props.deactivateCommitBox || (amend || this.isValidMessage()));
  }

looked like this:

    return !this.props.isCommitting &&
      (amend || this.props.stagedChangesExist || this.props.isMerging) &&
      !this.props.mergeConflictsExist &&
      this.props.lastCommit.isPresent() &&
      (this.props.deactivateCommitBox || (amend || this.isValidMessage()));
  }

it would probably work fine (not sure). Would like to have feedback from someone from the Atom core team.

smashwilson commented 4 years ago

@mstmustisnt Huh, would it be that easy? I'd take a PR with that and a test 😄

JapinderSandhu commented 4 years ago

In my case, when I got this message, I just needed to save the file in Atom (File>Save) and then I just clicked Stage or Stage All in the Git side panel and the files were staged (as if I typed "git add ." from the CLI). Hope this helps someone.

that worked. just saved the file

ajostergaard commented 4 years ago

I had to not only save the file manually, as others have described, but also introduce a change into the file, e.g. a new empty line or a comment, in order to be able to commit the merge.