+1 vote
1 view
in Devops and Agile by (28.1k points)
edited by

I have a Git repo that I have deleted four files from using rm (not git rm), and my Git status looks like this:

#    deleted:    file1.txt

#    deleted:    file2.txt

#    deleted:    file3.txt

#    deleted:    file4.txt

How do I remove these files from Git without having to manually go through and add each file like this:

git rm file1 file2 file3 file4

Ideally, I'm looking for something that works in the same way that git add . does, if that's possible.

1 Answer

0 votes
by (48k points)
edited by

For git version 1.x use

git add -u

Which enables git to automatically stage tracked files -- including the deletion of previously staged files.

For git version 2.0 use the commands 

To stage a whole working tree

git add -u :/

For current path 

git add -u.

These commands will add the staged files and delete the files that are not present on a local disk.

For more information please go through the following tutorial to get more info about git:

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...