Git add -p: a powerful git feature
johnkary.net
Git add -p: a powerful git feature
1–10 of 108 posts
Re: Git add -p: a powerful git feature
#2"git add -i" is my favorite command to start the interactive mode to add multiple files to staging at once.
Re: Git add -p: a powerful git feature
#3Yeah, this is a great tip. It's great for a final review prior to actual commit. Often, I'll build my commit message based on my walkthrough at that point. Additionally, you get cleaner diffs because you can skip over goofy stuff like whitespace changes (which you then can destroy after the commit by a quick git checkout HEAD myfilewithwhitespacechangesinit)
Re: Git add -p: a powerful git feature
#4Agreed. It's a triviality but git add -p is one of the main reasons my commits in Git are cleaner than in SVN. It's also one of the advantages I cite when advocating for Git.
Re: Git add -p: a powerful git feature
#5But I am using it!
Re: Git add -p: a powerful git feature
#6OT: 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.
Re: Git add -p: a powerful git feature
#7Site wont load for me.
I'm a big fan of "git gui". You can commit individual lines.
Re: Git add -p: a powerful git feature
#8I Always use -p.
I can't count the number of times I've caught stuff that wasn't supposed to be committed.
Also, site isn't loading for me so maybe this is discussed, but I also like using it to not commit logging / debugging statements without removing or stashing them.
Re: Git add -p: a powerful git feature
#9John Kary's page is down, but he created two screencasts, which are the meat of his post:
Re: Git add -p: a powerful git feature
#10There's also 'git reset -p' to interactively unstage changes