Hacker News new | ask | show | jobs
by ozim 7 days ago
That’s something I have the same thoughts on, because long time ago I used CVS/SVN and staging area with stashing was exactly the answer for what you wrote.

Combined with stashing you can quickly build to see if the commit builds.

Git supports all of it and people and jj are just complicating it by “let’s skip all of that and make a commit” because they don’t see it actually is simpler.

I just see how in 5 years someone who would be used only to jj will come over and re-invent staging and stashing “because I want changes but I don’t want to make a commit”.

1 comments

If you look at my initial comment, you will notice that stashing is exactly what I suggested as the traditional clean way of doing it. The thing is that if you already have stashing/shelving, you don't need a staging area for commits at all [1].

And a staging area is arguably the more error-prone and less ergonomic approach, giving rise to more UI complexity like git diff --cached, git diff HEAD, and plain git diff all being necessary functions. Or the git reset --soft/--mixed/--hard triad.

This ultimately results from the design decision that the staging area is a revision in all but name (it is a set of changes, after all), but cannot be addressed as one, so additional UI ceremony is needed. (See e.g. Mercurial and Sapling, both of which allow you to add and remove changes to and from the current commit, and thus avoid this unneeded complexity.)

[1] That git also uses the staging area for merges is a separate issue.

> If you look at my initial comment, you will notice that stashing is exactly what I suggested as the traditional clean way of doing it.

Stashing might be "clean" - but "clean" just means primitive in this sense, it's a bad thing - but it destroys local state and I don't want that.

> And a staging area is arguably the more error-prone and less ergonomic approach, giving rise to more UI complexity like git diff --cached, git diff HEAD, and plain git diff all being necessary functions. Or the git reset --soft/--mixed/--hard triad.

The problem is in the UI, all those operations can be expressed much more naturally if one used a good UI like Magit.

> This ultimately results from the design decision that the staging area is a revision in all but name (it is a set of changes, after all), but cannot be addressed as one, so additional UI ceremony is needed. (See e.g. Mercurial and Sapling, both of which allow you to add and remove changes to and from the current commit, and thus avoid this unneeded complexity.)

The staging area is not meant to be addressed, but only to be temporarily used in a brief process of selection of changes to be included into a commit. Keeping changes for more than a few minutes in a staging area is the wrong way to use it.

One final note, since it does not seem we will reach agreement.

> Stashing might be "clean" - but "clean" just means primitive in this sense, it's a bad thing - but it destroys local state and I don't want that.

Stashing is the logical inverse of staging, with the stash taking the place of the staging area. It is not more or less primitive than the staging area and it does not destroy local state, as it is entirely and easily reversible and composes with other operations (esp. if unshelving is implemented via a proper merge as it should be). There is nothing sacrosanct about local state; it gets changed or "destroyed" everytime you modify a file. This is normal for a worktree. In addition, it allows you to actually see what the commit looks like before you commit it, to view, compile, or test it as needed, rather than just eyeballing it.

> The problem is in the UI, all those operations can be expressed much more naturally if one used a good UI like Magit.

If that is your argument, then you do not need a staging area for your apparent use case, as you can select the changes you want to commit in the UI (in fact, in JetBrains IDEs that works analogously regardless of whether you use git or another VCS without a staging area). In this case, having the staging area is empty ceremony.

> One final note, since it does not seem we will reach agreement.

We won't because you're set on having a local-only (or local-first) workflow whereas I want a system where the remote CI/CD service is an essential part. I'm only interested in a development flow that requires Internet connection at all times, especially for enterprise work.

> It is not more or less primitive than the staging area

I should have said "crude". Stashing is simply a poor choice.

> as it is entirely and easily reversible

It's not: often, after stashing you realise you need to make further modifications, after which the stash doesn't apply any more and even a proper merge is not guaranteed to work.

> There is nothing sacrosanct about local state; it gets changed or "destroyed" everytime you modify a file

There's everything sacrosanct about it. I don't want a VCS to do that without my consent.

> In addition, it allows you to actually see what the commit looks like before you commit it, to view,

I don't need to view it that way. I will upload the commit to the online UI and view it there.

> compile, or test it as needed, rather than just eyeballing it.

I don't want to compile or test locally. The CI/CD environment assures repeatability and has access to many orders of magnitude more compute.

> If that is your argument, then you do not need a staging area for your apparent use case, as you can select the changes you want to commit in the UI (in fact, in JetBrains IDEs that works analogously regardless of whether you use git or another VCS without a staging area). In this case, having the staging area is empty ceremony.

The staging area is a necessary primitive. On a VCS that doesn't have it, JetBrains will have to implement it.