atom / github

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

Use friendlier names than "ours" and "theirs" for conflict sides #519

Open smashwilson opened 7 years ago

smashwilson commented 7 years ago

Presenting conflict sides as "ours" and "theirs" is unclear, especially when:

The ref name of each side of the conflict does appear in the conflict banners, but it's often something like "HEAD" which is likely to be confusing for git newcomers.

I'd like to present a clearer name in addition to the "ours" and "theirs" nomenclature, possibly a logical name of the ref based on output from git describe or git rev-parse. I'm open to suggestions about what command that should be :grin:

Follow-on work from #385.

/cc @maxbrunsfeld

simurai commented 7 years ago

To make it more clear, how about adding the commit message? It already does it for "ours":

screen shot 2017-02-18 at 11 16 34 am

Maybe add the committer avatar, name and time?

conflict

Currently it could link to .com to see more infos. Then it's pretty clear and you probably don't even have to pay attention to the "ours/theirs". Easy to always pick your change and ignore the rest. :stuck_out_tongue_winking_eye:

simurai commented 7 years ago

Then the <<<< |||| >>>>> might not even be needed? They're just there for text only when no other UI is available. And you don't want to edit these lines anyways.

conflict 2

simurai commented 7 years ago

Hey, isn't it that in most cases, you don't pick either of the 2 changes, but a combination of both? In my (limited) merge conflict career I rarely came across the situation that two people changed exactly the same word/name/number. Most conflicts happened because stuff gets moved around or if in the same line something got changed in two different places.. like

So I usually pick one change and then copy & paste from the other change.

Is it possible to make that automagic? :sparkles: Like take only the difference from both and apply them together? Like have an additional Use both button:

conflict 4

There would still be the "Dismiss" and "Resolve as Theirs Then Ours" options if you want to hand edit it.

Anyways, not that high on the priority list, just maybe an idea for "one day ™".

anaisbetts commented 7 years ago

How about instead of "ours" show "on this computer" and instead of "theirs" show "on origin/BRANCH"

simurai commented 7 years ago

How about instead of "ours" show "on this computer" and instead of "theirs" show "on origin/BRANCH"

Currently would be fine, but at some point we probably want to support merging two local branches and also stashing?

Maybe just indicate which are the changes from the current branch (that you're on).

smashwilson commented 7 years ago

Maybe add the committer avatar, name and time?

Ohh I really like this idea and mockup :sparkles: :smile:

Then the <<<< |||| >>>>> might not even be needed? They're just there for text only when no other UI is available. And you don't want to edit these lines anyways.

They are not needed! Fun fact: the original package hacks this in by using overlay decorations for the control bars that are positioned exactly over the <<<< |||| >>>> ("banner") lines. That's a pretty terrible way to do it because (a) it constrains the control bars to specific dimensions, which are somewhat too small to gracefully render the buttons and (b) you can still technically move the cursor beneath the decoration and edit the banner lines even though you can't see them.

Another fairly simple alternative would be to delete them during parse. I don't like that because it modifies the buffer before you do anything and because it messes up the line numbers.

I think the Right Way to do this :tm: requires some upstream core work: adding a way to decorate the banner lines to cause the TextEditor to omit them from rendering. @nathansobo and I talked about this, I remember.

Is it possible to make that automagic? ✨ Like take only the difference from both and apply them together? Like have an additional Use both button: [..]

Hmm! That's a neat idea. Or maybe even just an "I Feel Lucky 🍀 " button or menu option that falls back to a word/character-level merge?

How about instead of "ours" show "on this computer" and instead of "theirs" show "on origin/BRANCH"

Currently would be fine, but at some point we probably want to support merging two local branches and also stashing?

It may be interesting to try to detect common scenarios like "local branch, merging in remote tracking branch from GitHub remote" to show specific phrasing like that.

Maybe just indicate which are the changes from the current branch (that you're on).

That's actually exactly what "ours" means now :wink: The "ours" side of the conflict will always be the changes from the branch that was HEAD immediately before you ran the command the caused the conflicts (merge, rebase, cherry-pick, stash, ...). In git-land that's true for everything but rebase, but I handle that case explicitly.

simurai commented 7 years ago

Another fairly simple alternative would be to delete them during parse. I don't like that because it modifies the buffer before you do anything...

Yeah, that could be too intrusive. We're still an editor, after all. Ok, here another exploration. Where the code mostly is untouched and all the controls are moved into the gutter for clutter free editing:

conflict 2

☝️ This is what you would see when clicking on an item in the conflicts list. Some notes:

Then once you made a choice or modified to your liking you can click on any of the 4 buttons. It would keep that part of the code and clean up the rest:

conflict 4

Like always, there are probably edge cases that need to be considered.. like:

Buuuut.. all that said. Let's leave this simmer for a while and maybe come back to it later. https://github.com/atom/github/pull/385 is already a great help and using it for a while maybe gives more ideas. I just wanted to post this here while my mind is still in the conflict zone.

/cc 👀 @atom/design

calebmeyer commented 7 years ago
  • 🍔 button opens a menu with additional options

What other options?

For the side panel buttons, in the mockup they are aligned with their text. What happens when the text is too large to fit on one screen? Do they try to align themselves with their respective sections, or stay in place?

Something I'd like to see is a "I'll handle this one myself" button (maybe styled as a close button?) that removes all the UI. For the side panel idea, it works out that way pretty nicely (the UI is out of the way of editing if I want to edit)

50Wliu commented 7 years ago

You can already remove the UI per-conflict through the additional hamburger menu options. https://github.com/atom/github/issues/1078#issuecomment-320984164