Re: Question: is there a possibility of getting a warning before a git push -f

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 10 Jun 2025, at 12:12 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> 
> Aditya Garg <gargaditya08@xxxxxxxx> writes:
> 
>> One thing I sometimes encounter is that I sometimes git push -f and
>> moments later I realise I did it at the wrong time, result being a
>> disaster. I was wondering if a little [y/N] warning could be possible
>> before the risky command gets executed. I saw the code for push
>> superficially and I don't think it's implemented. I think it would be
>> a nice feature though.
> 
> I suspect that an even nicer feature that is more generally
> applicable is a patch to your shell to make any command you give it
> is not run for a few seconds to give you a chance to kill it with
> ^C.  You do not want to run around castrating a bunch of commands
> and features like "git push", "rm", ">overwrite-with-redirect", and
> all the other "destructive" things you may regret doing.  There are
> literally too many.
> 
> Quite honestly, "-f" or "--force" should be a hint enough that the
> user wants the command to do what the command usually does not allow
> them to do to avoid potentially dangerous operations.
> 
> I would expect that many people will truly get annoyed when "git
> anycommand --force" starts asking "That's very dangerous---are you
> sure?" for confirmations, and would complain "Yes, otherwise I
> wouldn't be giving you '--force'---just do it as I told you".

Fair




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux