Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Others already mentioned rebasing, but I think the most important tool is the index, or "the staging area". Lots of people not used to Git tend to see the index as an unnecessary extra step, but it's really what enables the good stuff.

In short, the index allows you to decide what goes in a single commit, regardless of the actual contents of a working directory. You can commit only a single line from a file if you want. If you learn how the index works and why it works like it does, understanding the rest becomes much easier.

You can also eg. resolve a conflict piece-by-piece by adding resolved parts to the index, diffing against the working directory, and then finally committing once the content of the index looks correct.

There are many tutorials and I'm not sure which one is the best but I think the book "Pro Git" does a good job at explaining the index among other things. It's freely available online at http://progit.org



Sorry I read your original as 'crafting perfect commit messages'.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: