News for hackers. Stuff that matters.
Re:High-Level Problems with Git and How to Fix Them by carussell on Tuesday December 12, 2017 @01:29AM (#15903421)
Partial commits through piecemeal staging is great as a poweruser's tool, like rebase. But it's beyond weird that anyone thought it was a good idea to make people deal with staging for every commit.

It doesn't even have to go away. (And on that note, I'm bummed that the conclusion in the article is to do that, especially because everytime this comes up, there's an uproar.) But, jeez. Just tuck it away so futzing with it is an opt-in decision for the 5% of the time that you need to make sure you aren't committing all of your changes. (And on note #2, if a person is doing partially staged changes more often than that, my question is why? What kind of chaotic, stream-of-consciousness style of development leads to that, and is it even producing good results? It doesn't take especially careful planning to not end up in the scenarios where partially committed changes is the answer.)

Re:High-Level Problems with Git and How to Fix Them by uiri on Tuesday December 12, 2017 @03:03AM (#15903800)
Often I'll work on a large change and make sure that it is working before I start crafting my commits. By the time I get to that point, I realize that I've actually made three separate subchanges so I do partial stages to create each commit.

I use git status -s and git diff quite a bit as a sanity check (for things like whitespace) and to do first party code review before I send anything out.

The staging area is a core part of my personal git workflow pre-commit. It seems to be producing good results so far.

Re:High-Level Problems with Git and How to Fix Them by masklinn on Tuesday December 12, 2017 @07:57AM (#15905250)
> I realize that I've actually made three separate subchanges so I do partial stages to create each commit.

You can trivially replicate that without staging by amending the HEAD commit, or building a bunch of partial commits then folding them with rebase -i. You can even do that automatically by committing with --fixup or --squash

Re:High-Level Problems with Git and How to Fix Them by uiri on Tuesday December 12, 2017 @11:35AM (#15906892)
That assumes that I'm making multiple smaller commits along the way. I'm not. Without staging, I'm stuck making one big commit. Splitting a single big commit into multiple smaller commits with an interactive rebase is dependent upon the staging area too.
Re:High-Level Problems with Git and How to Fix Them by masklinn on Tuesday December 12, 2017 @11:38AM (#15906925)
> That assumes that I'm making multiple smaller commits along the way. I'm not. Without staging, I'm stuck making one big commit.

Errr… no you're not. `commit -p` exists.

Re:High-Level Problems with Git and How to Fix Them by enzanki_ars on Tuesday December 12, 2017 @01:56AM (#15903531)
I have ADHD, so often as I am working on one feature, I will begin accidentally working on another unrelated feature along side it. I rely on staging a lot to ensure that each commit has only the parts that it needs.
Re:High-Level Problems with Git and How to Fix Them by therein on Tuesday December 12, 2017 @03:53AM (#15903994)
Same here, I actually find `git add -p` to be very useful.
Re:High-Level Problems with Git and How to Fix Them by masklinn on Tuesday December 12, 2017 @07:57AM (#15905255)
commit also has a -p flag.
Re:High-Level Problems with Git and How to Fix Them by tome on Tuesday December 12, 2017 @11:30AM (#15906836)
Oh wow. No need for me to use git add ever again!

EDIT: I suppose I have to use it to add new files :)

Re:High-Level Problems with Git and How to Fix Them by akx on Wednesday December 13, 2017 @04:47AM (#15913195)
Just use `git add -i` to mix and match :)
Re:High-Level Problems with Git and How to Fix Them by wutbrodo on Tuesday December 12, 2017 @01:06PM (#15907874)
For my first couple _years_ with Git, I just passed the -a flag in upon every commit. This is a pretty easy, low effort habit to form, so this reduces to a question of which default to set. Git's approach seems to be that the default should be to nudge users toward power usage, which I don't think is necessarily a bad thing. (Note that git's approach to defaults in other areas, like potentially destructive actions, is actually a problem).
Re:High-Level Problems with Git and How to Fix Them by txdv on Tuesday December 12, 2017 @02:50AM (#15903750)
If you consider the use case "linux kernel development", you realize that you really don't want to automatically commit all your changes.
Re:High-Level Problems with Git and How to Fix Them by TickleSteve on Tuesday December 12, 2017 @07:02AM (#15904935)
...and why is kernel development any different to any other large scale project?
Re:High-Level Problems with Git and How to Fix Them by carussell on Tuesday December 12, 2017 @02:18PM (#15908559)
I do consider the LKML-centric use case. (Often—probably more often than most.) No such realization is setting in. How about you elaborate?
Re:High-Level Problems with Git and How to Fix Them by nhaehnle on Tuesday December 12, 2017 @02:35AM (#15903684)
Git doesn't actually make people deal with staging for every commit, though.

It's quite common to tell newcomers to always `git commit -a`, and `git add` for adding new files. That's pretty much exactly where SVN is/was, and nobody complained about that being complicated or onerous either.

Re:High-Level Problems with Git and How to Fix Them by jwilk on Tuesday December 12, 2017 @10:24AM (#15906183)
You probably want "git add -N"; otherwise "git diff" won't work as expected.