3 ms·
I think the present tense recommendation comes from the expectation that each commit works as a stand-alone patch. Thus the commit message does not describe wha
by chousuke 15y ago
I think the present tense recommendation comes from the expectation that each commit works as a stand-alone patch. Thus the commit message does not describe what changes you did to the repository, but what the patch does to it.
Git provides a wealth of tools to craft perfect commits, and if you use them, it's not difficult to end up with a nice history of "add this, remove that, modify something else" changesets that (usually) would make sense even when separated from the surrounding history.
- akkartik 15y ago"Git provides a wealth of tools to craft perfect commits" Pointers please?
- lautis 15y agogit rebase http://progit.org/book/ch6-4.html http://progit.org/book/ch6-4.html
- chousuke 15y agoOthers 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 http://progit.org
- akkartik 15y agoSorry I read your original as 'crafting perfect commit messages'.
- floggit 15y agogit amend git rebate -i ...