Thursday, January 19, 2012

deleting a file

If you read any of the Git references they all say the way to delete a file from your repo is git-rm, but it turns out that you can also just as easily delete it (from your filesystem), stage it and then commit it.

If you come from Subversion, like me, this might seem like anathema but it works just fine (maybe it works just fine in Subversion too, ha!).

And it's quite convenient if you're like me and using an IDE but not using a Git plugin, and you didn't create a .gitignore file for your binaries, so every time you recompile, and your binaries change their changes are tracked, and if you had a Java inner class, so you got one of those file$1.class files, and then you removed the inner class then it got deleted when you recompiled, but you never ran the git-rm command, it's all going to be OK, because you can just do git-add --all and then commit. Ah, all better.

No comments:

Post a Comment

Fork me on GitHub