Live data from Hacker News

Using Git add -p for fun (and profit)

techne98.com

21–30 of 80 posts

Re: Using Git add -p for fun (and profit)

#24
A disadvantage of git add -p is that it allows you to create a commit that never existed on the development system, and, hence, cannot have been tested.

How do people handle that? One way would be to follow it up with git stash, running tests, and, if necessary, git amend, but that can get cumbersome soon.

Re: Using Git add -p for fun (and profit)

#26
I strictly use git add -p.

for one, it lets me create small patches of related stuff. There's nothing wrong with major patchsets in general but it makes it harder to cherry-pick little fixes to old stable branches for example

two, I notice other developers making me do the work for them because crap sneaks into their commits, like debugging statements or accidentally removed hunks. Instead I have to do "git add -p" when reviewing their commit.

Essentially, it's a first pass staging area you can review what you did. beautiful.

Re: Using Git add -p for fun (and profit)

#29
post #24

A disadvantage of git add -p is that it allows you to create a commit that never existed on the development system, and, hence, cannot have been tested. How do people handle that? One way would be to follow it up with git stash , running tests, and, if necessary, git amend , but that can get cumbersome soon.

That’s what CI is for.
Post reply on HN