Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This seems like a pretty terrible workflow to me, do others here actually work like this?

I only use git-add -p when I've screwed up and didn't commit when I should have, so I have to split the current commit into two. It seems to me that rebase -i and merge --squash are better suited to re-writing history in the way that's being done here. I'm especially distrustful of any workflow that includes the line "I eyeball the diff".

But I'm no git guru. Is this a common way to work? Are there advantages over the alternatives?



I have to shift my brain into totally different modes between programming and reviewing/testing/version-controlling, and git add -p is an important tool. Maybe you're disciplined enough to keep a queue of everything you'd like to do in your head at once, and only stick to one task at a time, and shift into review/test/commit mode between quantized chunks. Me, I just go in, hack for a bit, and when I run out of ideas, I shift modes, read the git diff, break out my work into chunks, and then add -p/stash/test/review/commit chunk by chunk.

If you want all of my commits to be functionally and semantically separate and individually tested, I can give that to you. git-add -p is just an interface between that well-disciplined software-engineering expectation and what my brain actually does when it gets into flow.


It means you keep your original history around & build a new one which breaks the code changes into functional chunks.

Rewriting your existing history with git rebase -i is fine until it goes horribly wrong & you have to go groveling through the reflog to work out which commits you need to rescue in order to retrieve your lost work.


I don't see that. Keeping your original history around is a function of doing cleanup on a separate branch. It has nothing to do with how that cleanup is achieved.

Rewriting your existing history with git reset can also go horribly wrong, which is why it's done on a separate branch here.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: