#89 It would be nice to have a "staging area" for changes

Opened by cole-h on November 17, 2020
cole-h on November 17, 2020

I don’t know how adverse this is to Pijul’s philosophy, but it would be very nice to have a staging area for changes. This may just be me longing for git functionality, but too many times now have I forgotten to remove some unrelated changes from the pijul rec window, only to notice after I’ve pushed. While pijul add already exists, a pijul restore (or similarly named command) would be a good companion.

pmeunier on November 17, 2020

I agree the staging area in Git is nice, but I wonder whether we could do that with just pijul rec --amend. Have you tried that command?

cole-h on November 17, 2020

I have indeed used pijul rec --amend to drop unrelated changes in the past, but when those changes are in Cargo.lock and multiple other files, it quickly becomes a hassle to track down which files I actually wanted in that record. I probably just need to use pijul more and stop comparing everything to how git does things.

robx on November 22, 2020

Some thing to try first maybe is to make pijul rec a bit more friendly to recording partial changes. E.g. some interactive version like what git add -p does, where you can pick changes one-by-one or by file.

Or allowing to record multiple changes from one pijul rec editing session, by grouping them under different change header sections.

Or instead of staging changes, there could be some support for marking certain changes as “irrelevant”? Along the lines of pijul rec --ignore Cargo.lock which creates a change that is somehow tagged as “ignored”, and thus wouldn’t be pushed by default. Maybe along with something like pijul unrecord --ignored which would drop all these irrelevant changes.

pmeunier on November 22, 2020

I agree with all those comments. First, a general note (not an answer): any line starting with # is ignored in the change format.

I can think of multiple options:

  • Editor modes. I started to work at some on a VSCode mode for Pijul to try and think about what would be needed to do that. Even though I don’t use it myself, VSCode is by far the most popular text editor nowadays. See my attempt there: https://nest.pijul.com/pmeunier/vscode-pijul. I believe this sort of stuff could make editing changes easier.

  • Extra commands in change and record, for example pijul record --amend HASH --drop-files Cargo.lock. Can we think of a complete set of useful commands?

  • @robx: I was thinking of a more convoluted thing where “parked” changes would be kept on a separate channel, but this is super Git-like, your idea is way better. I guess these could be kept in the .pijul/config and editable both manually and with the commands, what do you think?