Why use git rm instead of rm'ing files, directories, etc. and then using git add -u? -


i'm having trouble getting git rm delete superfluous directory , it's files project. made me wonder why git rm accepted practice when deleting tracked files instead of rm -rf directory , files outside of git , git add -u stage , prepare deletion of tracked files? latter seems make more sense me dont understand advantages of git rm.

of course, there multiple ways something. advantages using git rm has, are:

  • you control index, not real file system. fact git removes file in file system utility.
  • this means can remove files git without deleting them: git rm --cached.
  • you can precisely remove files want removed, unlike git add -u adds changes index.

especially last 1 important me personally, want full control change add commit. using add -u make me happy (just add .). of course, if happy using add -u, feel free use it.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

c++ - Accessing inactive union member and undefined behavior? -

php - Get uncommon values from two or more arrays -