Reputation: 1734
I'm having trouble getting git rm
to delete a now superfluous directory and it's files from a project. This made me wonder why git rm
is the accepted practice when deleting tracked files instead of rm -rf
the directory and files outside of git and then git add -u
to stage and prepare deletion of the previously tracked files? The latter seems to make much more sense to me but I probably dont understand the advantages of git rm
.
Upvotes: 2
Views: 306
Reputation: 387667
Of course, there are always multiple ways to do something. Some advantages that using git rm
has, are:
git rm --cached
.git add -u
which adds all changes to the index.Especially the last one is very important to me personally, as I want full control about what change I add to a commit. So using add -u
will rarely make me happy (just like add .
). But of course, if you are happy with using add -u
, feel free to use it.
Upvotes: 7