Does git clean support moving to Recycle Bin?

I would feel much more comfortable using git clean if I knew I could undo the deletion in case something goes wrong.

Does it support Recycle Bin in any way, shape or form? If no, are there any workarounds that anyone knows of, such as an external tool using git clean -n to print out the files, and then moving them to Recycle Bin?

  • Escape # character in interactive rebase commit message
  • How to keep two git repos synchronized?
  • How can I know how much percentage of git push is complete?
  • List all the active branches in Git remote
  • How to recover files from a corrupted git working folder
  • Typical .gitignore file for an Android app
  • Run git pull over all subdirectories
  • Removing commit from middle of a branch
  • Add patch in git, all hunks matching regex in file
  • Can I use an ssh key for Azure git push deployment?
  • Git status does not show changes when creating repo in JGit
  • Git repository setup with binaries
  • 3 Solutions collect form web for “Does git clean support moving to Recycle Bin?”

    Put recycle.exe into your %PATH%

    Run git config --global alias.recycle !

    Put in your %PATH%:

    cd ${GIT_PREFIX:-.}
    git clean -xdfn "$@" | sed 's/Would remove //' | xargs -d \\n --no-run-if-empty recycle


    If you’re worried about losing files, you a “dry run” is really the only viable option:

    git clean -n

    or equivalently

    git clean --dry-run

    Git has no knowledge of the underlying desktop environment, and probably never will.

    Git GUIs are capable of showing you these files, but why on earth would you want to move them to the recycle bin in the first place? Just think about what you’re doing before removing files.

    Alternatively, add the files to a seperate branch in your repository, although that probably defeats the purpose of deleting them in the first place.

    unfortunately!! git doesn’t have this privilege. Whatever gone is gone!!

    git clean -fdxn

    Will do a dry run, and show you what files would be deleted if you ran

    And one more thing, that if you have added files and somehow deleted those files. In this case, you can restore these files by using below command:

    ‘git fsck –lost-found’

    It’s worth a try, but don’t get your hopes up too much.

    Git Baby is a git and github fan, let's start git clone.