Wednesday, July 9, 2008

Git for the lazy

I just wrote a guide for git, for people who don't know what a distributed version control system is, and don't care.

git for the lazy

That will take you from zero to hero... well, zero to something, fast.

On the side, I also gave Mercurial a shot, since I wanted to use it for some *shudder* Windows development. From what I saw, it lacked the two things I liked about git:
  1. Local, non-cloned repo "proper" branches (in progress though), and
  2. an index cache/staging area (I heard it has something similar, but I haven't found it anywhere).

So when it came down to git and Cygwin versus Mercurial and Window's cmd.exe, the choice was somewhat one-sided.

If I'm mistaken about either of those features, and anybody wants to fill me in, you're welcome to comment. :)


However, I do like Mercurial's local revision numbers. It probably works better for it than git though, since Mercurial's branches are essentially repository clones.


Anonymous said...

Hi! Thanks for the guide, it's very useful. Even for those of us who do care about version control!

One thing -- as pointed out by the first comment on this post, I think the section on how to fix mistakes needs correction. I followed your directions and ended up with lots of unexpected behavior!

I would edit it myself but i'm afraid i'm not exactly sure what the solution is.

tung said...

Oops, looks like you forgot to link to that post, but I ran through what I wrote, and yes, there is a problem.

git reset --soft HEAD^ pops off the latest commit, but leaves local file changes in tact in case you want to do something with them. But git commit --amend operates on the current head. The end result? The top two commits get mashed together, which might not be what you're after.

git reset --soft HEAD^ lets you git add more things to the last commit, and a normal git commit will save those changes.

git commit --amend should be used if you just want to change the commit message.