Live data from Hacker News

Git add -p: a powerful git feature

johnkary.net

21–30 of 108 posts

Re: Git add -p: a powerful git feature

#24

OT: I'd love an interactive "Learn Git" webpage where you could learn to use Git with demo scenarios. Something like "Try Ruby" but for git.

Check out the Peepcode screencast on Git: https://peepcode.com/products/git

Peepcode screencasts are worth every penny.

Re: Git add -p: a powerful git feature

#25
post #18

I don't ever use git -p directly, but I use magit ( https://github.com/magit/magit ) for emacs, which makes staging changes this way very easy.

Lately I find myself launching an emacs session just so I can use magit for projects I build in XCode.

It makes crafting commits a joy.

Re: Git add -p: a powerful git feature

#26
post #21

So you end up committing untested code? (since you did test the whole change, not just part of it). Sounds like a bad idea to me.

That is most definitely a major issue of this technique, though it can probably be mitigated through various hooks.

I find this technique great to keep unrelated fixes in separate commits. A single revision may not pass a set of unit tests, but the entire feature branch will before being merged into the release line. Keeping the barrier low for committed code is one of git's best features.

Re: Git add -p: a powerful git feature

#28
post #22
post #21

So you end up committing untested code? (since you did test the whole change, not just part of it). Sounds like a bad idea to me.

git stash -k; make test; git stash pop, git commit; Problem solved.

The problem is with the process, people will forget. You probably need to automate this.

Re: Git add -p: a powerful git feature

#30
post #28
post #22

Earlier quoted context omitted.

git stash -k; make test; git stash pop, git commit; Problem solved.

The problem is with the process, people will forget. You probably need to automate this.

If people forget to test their commits, they're going to forget them without using git add -p too.
Post reply on HN