How to remove untracked files from the current Git working tree?

0 votes

Hi Guys,

I have some untracked files in my Git repository. I want to remove these files. How can I do that?

Sep 4 in Git & GitHub by akhtar
• 29,340 points
68 views

1 answer to this question.

0 votes

Hi@akhtar,

If you have thousands of file then it is not possible to check manually and remove the untracked file. But Git has commands to remove files according to use case. So before removing any file, you can check what will be deleted using the below command.

$ git clean -n

Now to remove your untracked file you can use the below command.

$ git clean -f -X
answered Sep 4 by MD
• 67,880 points

Related Questions In Git & GitHub

0 votes
1 answer

How to get the files from the local desktop to the local repository?

Hey @Ali, Follow these steps to transfer ...READ MORE

answered Dec 17, 2018 in Git & GitHub by Arohi
83 views
0 votes
1 answer
0 votes
2 answers

How to view the nested workflow of a local git repository?

The closest way to view branches in ...READ MORE

answered Aug 2, 2019 in Git & GitHub by Sirajul
• 58,130 points
254 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
740 views
+2 votes
1 answer
0 votes
1 answer

How to remove remote origin from Git repo?

Hi@akhtar, You can remove or add a new ...READ MORE

answered Sep 4 in Git & GitHub by MD
• 67,880 points
89 views
0 votes
1 answer

How to create branch in GitHub from my local Git repo?

Hi@akhtar, To sync your existing branch in GitHub, ...READ MORE

answered May 7 in Git & GitHub by MD
• 67,880 points
92 views