4 ms·
>It's probably also possible on the cli, but I imagine that would be too 'hard' or time consuming, hence you will probably start to be lazy about doing it corre
by aninhumer 11y ago
>It's probably also possible on the cli, but I imagine that would be too 'hard' or time consuming, hence you will probably start to be lazy about doing it correctly.
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.
- jumpwah 11y agoSweet! 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.
- greg0ire 11y agoIt also works with reset and checkout, BTW.
- randlet 11y agoWow thank you. I had no idea that was something you could do!
- nitrogen 11y agoI 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.
- abalashov 11y agoThis 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.
- viewer5 11y ago> 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.
- sfilipov 11y agoHe 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-feature-youre-not-using-yet/ http://johnkary.net/blog/git-add-p-the-most-powerful-git-fea...