Git for personal projects
I’ve been using git for Tegaki for over a year now and I’m very happy about it. With GNOME moving to git, Fantasdic’s source code is now also managed with git. Git does have quite a steep learning curve but it is a very powerful tool once you master it.
A feature I like is branches. In SVN, branches are handled in separate directories. In git, when you switch to another branch, git swaps files for you so your file locations don’t change. This makes testing multiple versions of your code very straightforward.
Another feature I like is the stash. This is used to temporarily undo some code. For example, the other day, I was in the middle of something when my supervisor came and asked me to show him the progress of my demo program. I used “git stash” to come back to my latest commit and later I was able to re-apply my changes with “git stash apply”.
Because all commits in git are made offline (git doesn’t need a central server), git is a very good candidate for strictly personal projects as well. Lately I have been using it systematically, not only for code but for documents (reports, presentations) too. This is especially useful if your documents’ source is in text format, like LaTeX, because git can show you the diffs. Since I backup my git repositories on my server, I find git to also be a nice way to keep all my source code and documents in sync across all my computers (at the lab, at home).
August 15th, 2009 at 11:11 pm
Hooray for Git! I’ve been using it for over a year now too and haven’t looked back. Another feature I really like about Git is the “add -p” command. I use this all the time to untangle multiple changes that I have made to my working directory. If you’ve ever tried to do the same thing with Subversion’s “changelist” support, it’s harder to use and less powerful than git add -p.
August 16th, 2009 at 5:37 am
Hi Greg! Thanks for your comment and for pointing out git add -p. I didn’t know this command and it is indeed very useful. I found the following blog post which has a good explanation: http://blog.tplus1.com/index.php/2008/10/31/break-up-changes-into-different-commits-with-git-add-p/