by rbehrends · 1w ago · 0 comments
This would mean that you're changing already pushed commits, leading to mutable shared state, which is also not a desirable situation. (Aside from the fact that fixing up commits can be a somewhat painful business in Git.)
Also, this seems to be an inconsistency in your position. If it is okay to have poorly built commits because you can fix them after code review, why is building them carefully in the first place important?
> No it doesn't. The staging area is precisely what allows you to carefully build a commit. Before git, we had to do the same by backing up the modified files somewhere else and creating a commit, then bringing them back. I used to use CVS, then Subversion, then a mix of Darcs and Arch, before git finally solved it.
This is interesting, because Arch already had the concept of a stash (via the oddly named `tla undo/redo`, even if like much of Arch, it was a bit primitive). In any event, stashing/shelving as a concept already does what you want a staging area to accomplish, as I had pointed out above, without the problems introduced by the staging area. In general, the "backing up the modified files somewhere" was made unnecessary in most version control systems a long time ago.
> Using commits to save state is bad and I've forbidden it in my team. Jujutsu makes it more convenient so that uncommitted state is itself a special commit that gets pushed to the server, but the real solution is what Google's SrcFS does: workstations checkout code on top of a FUSE filesystems that really gets saved on the server side, so state can never get lost on a single machine.
You seem to have misread my statement, as I pointed out that this is a problem; we are not disagreeing here. That git does not really have a good way to support the functionality of saving repo state is the actual issue, but a shortcoming that is shared by almost all VCSes.
Doing this at the file system level is also not really adequate. It does not replicate the functionality of temporary snapshots and if it did (like the local history in JetBrains IDEs), it would be cumbersome.
A PR is a temporary container, and those commits there are in no meaningful sense "published" so they should be considered mutable.
> If it is okay to have poorly built commits because you can fix them after code review
Nowhere did I say that. Commits should be of very good quality, but there are diminishing results from putting safeguards over safeguards into the CI/CD logic: some qualities, like the conceptual integrity of a commit, should be enforced through review not code (CI/CD checks).
> stashing/shelving as a concept already does what you want a staging area to accomplish
No no no. I want to keep my local state while selecting a subset of those changes to be sent to the server for testing. Stashing destroys that, I never want it.
> In general, the "backing up the modified files somewhere" was made unnecessary in most version control systems a long time ago.
Actually it wasn't. I want my local state to be kept exactly as it is, in an uncommitted limbo, and the only VCS I've encountered that fixes that from the points of view of safety, clarity and ergonomy is Google's Piper with its SrcFS local component.
> Doing this at the file system level is also not really adequate.
It is, and I'll point again to Piper: every compilation attempt and every time one updates a Piper Changelist results in a named (numbered) snapshot that can be used in Critique (the UI) for comparison, either as NEW or OLD state. It's very sophisticated and works marvellously.