This was the 'killer app' that compelled me to switch to Git from Subversion back in the day, rather than anything else about Git intrinsically. The ability to organise my commits logically rather than temporally (i.e. not just as a stupid log of change over time) was like night and day.
Re:How to Write a Git Commit Message
by viewer5 on Wednesday September 16, 2015 @09:33AM
(#10226406)
> ability to organise my commits logically rather than temporally
I'm just getting started with Git; how do you do that? I googled it but nothing jumped out at me.
Re:How to Write a Git Commit Message
by sfilipov on Thursday September 17, 2015 @04:26AM
(#10232205)
He referred to what the GP said - use "git add -p". Here's some introduction (I haven't watched it myself and can't comment on the quality):
http://johnkary.net/blog/git-add-p-the-most-powerful-git-fea...
I recommend setting up a shell alias to do this. I have all of my frequently used git commands aliased to two- or three-letter mnemonics.
Sweet! I never bothered to check how to do it on the cli, and instead of being interactive, I just assumed you would have to reference the hunks by line number or something. Naive of me.
It also works with reset and checkout, BTW.
I do it all the time, you just use `git add -p` and it steps through hunks letting you stage them or not. As long as you don't make too many changes without committing, it's not particularly tedious.