Git clean -f -d

Important note:

Be careful with the following commands, they delete files permanently!

Explanation:

If you want to just remove all untracked files inside:

  • The main root directory
  • Or other already tracked (committed) directories

Just run this:

git clean -f

Note 1:

  • In the following commands, -f means force.
  • Also the new (untracked) files that are inside the new (untracked) directories will not be removed by the above command.

If you want to remove 1) untracked directories with 2) all their contents, in addition to what is done by git clean -f , you need to run:

git clean -f -d

Note 2:

If you stage a new file, it is no longer an untracked file. Remember we can stage a file with git add file_name.

With a staged file, the above commands git clean -f or git clean -f -d will not work.

--

--

--

Posting about Python and Laravel

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Exploring Alternatives to buddybuild

Log Sum Exp Trick!

ASP.Net framework and its common advantages.

How to Run Machine learning Model on Docker

WINNING RACE ROUND 1 HAS FINISHED!!!

How to delete a branch in GIT

Pillar Wallet Integrates RenVM

How to create widgets in android

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Panjeh

Panjeh

Posting about Python and Laravel

More from Medium

Jenkins Master Slave Configuration (Ubuntu Master & Windows Slave )

Laravel-Batch Use For Update to Array Data in Laravel

Encryption Techniques

The Definition of backend (for the non-technical)