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 28, 2020 in Git & GitHub by Shashi
• 360 points

edited Oct 28, 2020 by MD 251 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 28, 2020 by MD
• 95,010 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,120 points
72 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,510 points
1,060 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 6, 2018 in Git & GitHub by Sophie may
• 10,510 points
6,222 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,010 points
34 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
895 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,010 points
1,432 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,010 points
198 views