JetpackDuba / Gitnuro

A FOSS Git multiplatform client for newbies and pros
https://gitnuro.com/
GNU General Public License v3.0
872 stars 44 forks source link

Destructive actions should require confirmation #137

Open ProjectInfinity opened 1 year ago

ProjectInfinity commented 1 year ago

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.

JetpackDuba commented 1 year ago

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!

Mingun commented 1 year ago

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

JetpackDuba commented 1 year ago

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.

ProjectInfinity commented 1 year ago

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:

JetpackDuba commented 1 year ago

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.

Mingun commented 1 year ago

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)

JetpackDuba commented 1 year ago

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

ProjectInfinity commented 1 year ago

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.

Mingun commented 1 year ago

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

esotericist commented 8 months ago

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.