Live data from Hacker News

How to commit part of file in Git

newbeelearn.com

101–104 of 104 posts

Re: How to commit part of file in Git

#101

Earlier quoted context omitted.

You shouldn't have to edit a raw diff which is its own language just to split two adjacent lines. I'm not saying it should be fixed, I'm saying people should stop using the command line to do this entirely. (I find it quite funny that they ever did.) Oh, I forgot that it probably couldn't be fixed even if they wanted to because if split suddenly started working it would break someone's spacebar heating script.

It seems a stretch to call having a + character at the start of an added line “its own language”. Staging one line of the two in your example probably takes less than five seconds using this method; in the editor, you just delete the line you don’t want. If you personally prefer a GUI then that’s obviously your choice. Some people do and I doubt you’ll find many people claiming Git has the world’s best UI. It does wo…

It is slower and more error-prone. But some people enjoy that and it's a hobby, which is fine.

Re: How to commit part of file in Git

#104
post #27

Earlier quoted context omitted.

Also use git add -p frequently. I can't understand why people are even discussing using other tools.

It's because other tools are much better.

Maybe for some people? git add -p does everything I need, directly from the terminal which is where I use git already. It's also super fast, the only limit being how quickly I can parse each hunk and type "y enter" or "n enter". Very occasionally I want to split a hunk up more than it allows, but it's easy to work around.
Post reply on HN