Re: Revert and reset and very damaging Git commands

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

 



On 2022-07-11 17:40, brian m. carlson wrote:
On 2022-07-11 at 19:52:05, Gerriko io wrote:
Gosh this is not good.
Why are these commands bypassing all the fundamentals of a computer
OS. Surely if a file is deleted it should end up in the computer's
rubbish bin. Not deleted permanently without a trace.
In general, the programmatic interfaces used to create and delete files
don't use the user trash can.  That's because many programs create and
delete extremely large numbers of temporary files (Git included) and it
would be silly to expose those to the user, since the user trash can is
designed to handle files that the user specifically might want to
recover.  There is also no standard portable interface for placing files
into the user trash can, while there are standard portable interfaces
for actually removing files.

Also, traditionally, on Unix systems, deleting files has happened
without prompting, and Git is designed for Unix systems.

I'd like to add that in only very few cases git will remove untracked files that haven't even been added to the index - for example git clean -f (-f is force), as it's designed to remove untracked files.

In the case of reset, it could effectively wipe untracked files but only if you reset to a revision that has these same paths, else it would not touch untracked files at all.

Added files would however be affected but as pointed out earlier they are already in your object store and can be recovered using git fsck.

If unsure about a command, especially with a name like "clean" or "reset", all command are documented and the man page can be usually read using:

git <command> --help

--
Thomas



[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