Github: Remove "Undo Discard" affordance after committing

Created on 10 Mar 2017  路  17Comments  路  Source: atom/github

Once I have discarded once in a project, the "undo discard" button seems to hang around forever. This seems unnecessarily distracting. I like that this button hangs around even after edits, but it seems like we should maybe clear the discard history after committing the containing file.

/cc @kuychaco

enhancement staginunstaging

Most helpful comment

Manual fix to hide the _Undo Discard_ button. In your ~/.atom/style.less add this:

atom-panel-container button.github-StagingView-headerButton--fullWidth {
  display: none;
}

All 17 comments

After observing myself for a while, I tent to not trust that button unless I just discarded something a few seconds ago. If discarding happened a few hours ago, I'm never sure what that button does and if it's the "right" discard or if there was another discard after. So ya, I think it's ok to keep this button temporary and only for accidental discards.

For a more longer lasting "backup", we might could do the following that came up in #611:

Maybe once we have stashing #557, we could auto-stash every time you "discard all". It would override the last auto-stashed changes (to not clutter up the stash list). Kinda like an auto-save in games.

I'd really like to see undo discard go away at some point as well or have a way to dismiss it. I feel like it hangs around for a while and several times I've hit it instead of the file I wanted to stage which can cause some pain.

At the very least the button should be moved.

my +1 here, Why cant the discard cached memory just be cleared? like a dismiss option in the dialog options that pops up?

At the very least the button should be moved.

@nathansobo hows that a solution?

I would like to add a note that never once have I wanted to use that button for its intended purpose, but I regularly click it by mistake and end up with a very confusing file state.

Ideally this button would be dismissable, at the very least the prominence of this button should be reduced significantly. It's certainly not more important then "Stage All"

Would it be difficult to add an option to disable that button in the settings?

@ben-z have a read at https://github.com/atom/github/pull/1242 discussion. But short answer is they wont add what you suggest.

May have found a workaround.

  1. Undo the discard. Bring all those unwanted changes back up in the git tab.
  2. Click on the file you want to discard to open it in the editor pane.
  3. Click on the garbage can icon to discard the hunk. (Next to "Stage Hunk")
  4. Repeat this for all changes
    ...
    Haven't seen the Undo Discard button since. Hope that helps!

@andreidobrinski sorry if this sounds flippant, since #1242 discussion covers alternatives and a solution that is likely to be accepted. See https://github.com/atom/github/pull/1242#issuecomment-342625850 and https://github.com/atom/github/pull/1242#issuecomment-343346270

I think the discussion going on in #1242 applies to this ticket and should be had here though. For that end Ill make a friendly post there.

Meanwhile, Ill try your workaround. Thx for letting us know. ;)

@andreidobrinski Haven't seen the Undo Discard button since.

Even when discarding again? If so, that sounds more like a bug.

Here another idea: Move undo into the context menu:

screen shot 2018-02-20 at 10 29 08 am

It's a bit harder to discover, but if it's not your first discard, you might remember that there is an "Undo Last Discard" option.

Or even show "Undo Last Discard" all the time, but disable it if no undos are possible. Electron has an enabled: false option: https://electronjs.org/docs/api/menu-item

I missclicked again on this evil button...
It took me so long to find out where the change came from T-T

Here another idea: Move undo into the context menu:

This is pretty close to what I suggested in https://github.com/atom/github/pull/1242#issuecomment-341910846 and almost exactly what @BinaryMuse suggested in https://github.com/atom/github/pull/1242#issuecomment-342303559.

@simurai good point. I checked again and what happened is that the Undo Discard affordance moved from the global git tab to the file-specific one.
screen shot 2018-02-20 at 2 06 21 pm

would be nice to have an option to "permanently discard these changes, remove them from the Undo stash, and don't remind me again".

Manual fix to hide the _Undo Discard_ button. In your ~/.atom/style.less add this:

atom-panel-container button.github-StagingView-headerButton--fullWidth {
  display: none;
}

You can remove Undo Discard button via remove undoDiscardHistory manually:

  1. open .git/config file in project directory,
  2. remove [atomGithub] section, and save this file,
  3. reopen the project with Atom

1702 makes this much less prominent and harder to click on by mistake, so this is less of an issue now. We might iterate further on the UX here in the future, but it's not in our immediate roadmap, so we're going to close these. We'll open new issues in the future when we're ready for that 馃憣

Was this page helpful?
0 / 5 - 0 ratings

Related issues

smashwilson picture smashwilson  路  4Comments

danielbayley picture danielbayley  路  5Comments

HidekiHokuto picture HidekiHokuto  路  4Comments

yubaoquan picture yubaoquan  路  3Comments

move[bot] picture move[bot]  路  3Comments