How to untrack and remove a deleted file and log when we check git status

0 votes

When we do git status below message will display, changes not committed are still showing for a file that is deleted. Will these logs will be there always when we do git status or is there a way to untrack and remove it. Please provide commands if there any.

git status
# On branch feature1
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       deleted:    new1.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
Oct 29, 2020 in Git & GitHub by Shashi
• 370 points

edited Oct 29, 2020 by MD 17,380 views

1 answer to this question.

0 votes

Hi@Shashi,

You can use the git clean command. This command will remove all deleted files. 

$ git clean -f

You can also go through the below link for more information.

https://koukia.ca/how-to-remove-local-untracked-files-from-the-current-git-branch-571c6ce9b6b1

answered Oct 29, 2020 by MD
• 95,440 points

Related Questions In Git & GitHub

0 votes
0 answers

How to find and restore a deleted file in a Git repository?

Hi Team, I have one Git repository. I ...READ MORE

Dec 22, 2020 in Git & GitHub by akhtar
• 38,230 points
658 views
0 votes
1 answer

How to forcefully commit a file to Git even if the file is ruled as unchanged?

This is simple, just follow the below ...READ MORE

answered Jul 11, 2018 in Git & GitHub by Sophie may
• 10,610 points
12,396 views
0 votes
1 answer

How to give a file execute mode permissions in Git?

You can easily do this in one ...READ MORE

answered Aug 7, 2018 in Git & GitHub by Sophie may
• 10,610 points
20,380 views
+1 vote
1 answer

How to check out a remote Git branch?

Hi@akhtar, You can use the git checkout command ...READ MORE

answered Nov 21, 2020 in Git & GitHub by MD
• 95,440 points
357 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,458 views
+2 votes
1 answer
0 votes
1 answer

How to untrack a file in Git?

Hi@akhtar, You can untrack your file from git ...READ MORE

answered May 4, 2020 in Git & GitHub by MD
• 95,440 points
12,661 views
0 votes
1 answer

How to unstage a file in Git?

Hi@akhtar, Sometimes we accidentally add files in the ...READ MORE

answered Nov 19, 2020 in Git & GitHub by MD
• 95,440 points
620 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP