Gitnuro icon indicating copy to clipboard operation
Gitnuro copied to clipboard

Destructive actions should require confirmation

Open ProjectInfinity opened this issue 1 year ago • 10 comments

At the moment Gitnuro does not ask for confirmation when performing destructive actions such as deleting a local or remote branch. It's too easy to delete the incorrect branch if you're not paying very close attention.

ProjectInfinity avatar Jun 27 '23 09:06 ProjectInfinity

Hey!

Yeah, there used to be a confirming dialog but I removed it as it could be rather annoying (or not even that useful if the user doesn't read the text).

However, it's probably good to have have when trying to delete unmerged branches with a good and visible warning, since merged branches can be recovered easily.

As for remote branches I may apply the same logic.

Thanks for your feedback!

JetpackDuba avatar Jun 27 '23 10:06 JetpackDuba

I think, just need to add a setting(s) when you should ask confirmation.

Mingun avatar Jun 27 '23 11:06 Mingun

Nah, I'll probably keep it the way I've mentioned, as it's the best for the UX to prevent possible unrecoverable errors while not being annoying.

I want to avoid cluttering the settings panel for minnor stuff like that.

JetpackDuba avatar Jun 27 '23 11:06 JetpackDuba

Hey!

Yeah, there used to be a confirming dialog but I removed it as it could be rather annoying (or not even that useful if the user doesn't read the text).

However, it's probably good to have have when trying to delete unmerged branches with a good and visible warning, since merged branches can be recovered easily.

As for remote branches I may apply the same logic.

Thanks for your feedback!

In think in all fairness the miniscule amount of annoyance is acceptable when performing destructive (dangerous) actions such as deletion.

If you perform so many deletes that clicking one extra button becomes a point of problem for you, you likely have some more important issues to solve. :smile:

ProjectInfinity avatar Jun 27 '23 12:06 ProjectInfinity

Sorry, I should have expressed myself better. The problem is not only clicking on "Confirm", but the fact that the dialog shows.

If a user has to delete multiple branches, having the same dialog repeated over and over again will just make them ignore itafter the first time and just click on the button. If the dialog is shown just when deleting unmerged branches (which is an example of a destructive operation, because you don't lose really relevant information when deleting a merged branch), the user would be more likely to pay attention when it's shown.

In other words, the dialog is required when there is a real concern of losing data in the workspace.

JetpackDuba avatar Jun 27 '23 12:06 JetpackDuba

Actually, many operation in git are not destructive until you perform git gc. Deletion of a branch or a tag is one of the such action. Gitnuro could keep SHA reference in the memory, so if something was deleted by accident it could be very easily restored (if you not relaunch application)

Mingun avatar Jun 27 '23 13:06 Mingun

Yeah, there are plans to add some kind of "undo" and, if I can find a reasonable use case for it, reflog.

JetpackDuba avatar Jun 27 '23 13:06 JetpackDuba

Actually, many operation in git are not destructive until you perform git gc. Deletion of a branch or a tag is one of the such action. Gitnuro could keep SHA reference in the memory, so if something was deleted by accident it could be very easily restored (if you not relaunch application)

This is fine for a "Undo" button ala GitKraken but is too fragile of a solution when working with say a company's data. What happens if you accidentally hit CTRL+Q (shortcut for close window on most Linux desktop environments) or the application crashes before you get to undo the mistake?

It's clear to me that the correct approach is to alert the user of the destructive action and have them acknowledge it. If the user teaches themselves to ignore the dialog then that is a user issue I don't believe is fixable by Gitnuro.

ProjectInfinity avatar Jun 27 '23 13:06 ProjectInfinity

I agree that it is better to have a confirmation setting, but picture conveyed are not so terrible. To remove something from the git, you need to purposefully try. The proposed solution with Undo is designed to simply facilitate the process of what you can already do if you know how. At the same time it reduces noise for those who is self-assured

Mingun avatar Jun 27 '23 14:06 Mingun

imo the correct solution for "i need to delete multiple local/remote branches and don't want a popup for each one" is the ability to select more than one branch before performing an operation on the set.

this also presents the option of the confirmation dialog box being able to give pertinent information like which ones are unmerged, or which ones still exist remotely/locally (as relevant) so you can review them in case you included one by mistake

at the very least, destructive-and-inconvenient-to-recover actions should have the OPTION for a warning, even if it's technically reversible; i have a lot of motor control issues and also i have cats, which means things sometimes happen i did not intend.

esotericist avatar Oct 22 '23 06:10 esotericist