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 in Git & GitHub by Shashi
• 320 points

edited Oct 28 by MD 58 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 by MD
• 77,940 points

Related Questions In Git & GitHub

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,100 points
719 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,100 points
5,453 views
0 votes
1 answer

How to check out a remote Git branch?

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

answered 3 days ago in Git & GitHub by MD
• 77,940 points
7 views
0 votes
1 answer

How to do a re-merge into another branch in git

Seems like you want to rebase your ...READ MORE

answered May 7, 2018 in Git & GitHub by DareDev
• 6,870 points
696 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
804 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 in Git & GitHub by MD
• 77,940 points
910 views
0 votes
1 answer

How to unstage a file in Git?

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

answered 5 days ago in Git & GitHub by MD
• 77,940 points
12 views