Skip to content

Please add more safeguards to git clear #1167

@Welding-Torch

Description

@Welding-Torch

Hi,

This issue is in regards to the git clear command.

I was showing git extras to some people today using the git repl. I typed clear to clear the text in the repl. It asked me if I was Sure. I thought it was asking me if I was sure that I wanted to clear my screen. I didn't think for more than a few seconds about it and I typed "y" for yes. It didn't clear my screen. What it actually did was hard delete 4 files worth of code that existed only in that directory with no other copies.

I do realise that this is my mistake and that I was in a rush, so I didn't pay enough attention.

However, I still want to urge @tj and team to add some more loud safeguards to git clear so that users understand that the action they are about to take is absolutely irreversible and will delete un-tracked code. I would suggest doing this by:

  1. Printing the line Sure? - This command may delete files that cannot be recovered, including those in .gitignore [y/N]: in CAPITAL and red color letters.
  2. Asking the user a second time just to make sure. And printing the list of files that are about to be affected by this command.

Thank you. I sincerely hope you act on this.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions