dPompa Blog

Working with Git

I’ve been researching Git for some time now and started using it full time. I decided to give Git a try after having a lot of pain with SVN. The experience until now has been absolutely amazing!

At it’s core, Git aims to track content rather than files. This simple concept turned out to be amazing in my workflow. During a work day I tend to move a lot of stuff. I touch a lot of files for fixing a single bug, and rename or move resources around (and I usually have a lot of them). Then after I fixed my bug or finished my feature I’d like to commit my work. With SVN this is where things blow up. It usually shouts a bunch of random errors at me and dies. Stupid stuff like “this directory is already under version control”. But WTF? I just moved this directory so duh! It is and it should be under version control. I just want to commit please.

After hitting my head against the wall I realize that the directory I moved had a hidden .svn directory inside it. This causes SVN to blow up. Fine. I have my svnrm script I wrote just for this occasion: to scan all directories and delete the stupid .svn directories. OK, now I should delete the directory with the old name and re-add the new one (all I did was to move or rename the directory). Ahh, finally SVN let’s me commit.

This exact same process with GIT feels exactly the opposite. After hacking around all day I just type git gui. This fires up Git’s UI which shows me a list of files, some marked as deleted and some marked as new. Fine. I select the added and deleted files, hit Command+T, type my commit message and click Commit. That’s it. Now my history shows a nice rename/move from the old location/name to the new one. Simple isn’t it? That’s what I expect from my version control system.

But Git doesn’t stop there. The way I work is hack around all day and then at the end of the day I commit. With SVN I can choose only which files I’d like to commit. But since most files have a lot of changes related to many topics I end up committing it all at once.

With git gui I can see which files changed as well as the changes themselves inside each file. If a bug touches a lot of files I can just right click on the relevant changes inside each file, and build a commit that’s relevant only to a single topic. This let’s me work all day and then review and commit my work by topic. With Git, I end up with a much more organized history, letting me get exactly to the point I’d like later.

To sum up, if you haven’t given Git a shot yet, you don’t understand what you’re missing. Especially if you’re working with a clunky tool like SVN.

Leave a Reply