Some people have recently asked questions about why we even have a "git rm" command since it seems so pointless if you understand git's model and "commit -a" well enough. I wrote that command, so let me explain. The problem I was trying to address is that a new user (me), was trying to learn git and made it through a scenario like this: git init-db echo a > a git add a git commit "Cool, that works. Now let's explore file deletion:" rm file git commit "Hmm... that' didn't work, and git commit says: # (use git-update-index to mark for commit) # # deleted: file I explored the documentation and found "git update-index --remove file" and thought, "this git system is insane! what a horrible command line that is!" So, with "git commit", it doesn't work to just plain delete the file. Now, a really cool thing about git and something that makes it easier than other systems, (like cvs say), is that you don't _have_ to do anything extra to tell it about file deletion, (nor file rename). But to get the cool feature to work, you have to use "commit -a": rm file git commit -a Is our new documentation going to lead users to discover this great feature? We're talking about documenting "commit -a" as, "'add' all tracked files then commit". It would take an exceptional stretch for a new reader to take that sentence and realize that it would also mean that any deleted file would also be removed from git's tracking. We're using a verb with the _opposite_ meaning for crying out loud! So, back to "git rm". I added it not just because some people might be trained to tell the SCM about file removal. I added it to make "git commit" seem more reliable, (since it can feel broken to new users---it doesn't seem 'smart' enough to just figure out what changes have been made to files that are being tracked). So we should show the "smarter" behavior to users by default. Then "git commit" wouldn't feel broken. We could even throw away "git rm" and use its absence as a selling point for git. "Hey, git's actually _easier_ to use than that broken stuff you've been using." Wouldn't that be great? -Carl
Attachment:
pgp5cHDWD2RKu.pgp
Description: PGP signature