Magit allows selective staging/unstaging, either of hunks, or by selecting lines (AKA Emacs's "region"). I avoid staging from the git commandline, unless I'm just doing whole files. PS: Majutsu provides this too (a magit-like tool for jj)
The per-line staging in magit is a frequent tool I use. I can be in the middle of bunch of other changes, change 1 line for a different reason that would otherwise be "mid-hunk", and the stage & commit it with its own explanation. It releases me from having to have the "discipline" to stay 100% focused on the broader task at hand and say "hmm, I should fix that while I'm here", without co-mingling purposefully differ…
Staging patches with git add (2024)
41–50 of 54 posts
Re: Staging patches with git add (2024)
#42> If you’re not already using git add -p to stage your commits then you’re missing out. After switching to jujutsu, I assure you I don't miss this feature. jj takes the opposite approach. It keeps staging things, and you use split whenever you want to separate things out. (And yes, it stores the staged changes as revisions, so you can always back out to a previous staged state).
> jj takes the opposite approach. It keeps staging things, and you use split whenever you want to separate things out. You can use `git reset -p` to selectively unstage hunks the same way if you wanted to.
Whereas with jujutsu, after learning it once, I never looked up `split`.
And it's not like I use `split` often. I can go weeks without it.
Re: Staging patches with git add (2024)
#43> If you’re not already using git add -p to stage your commits then you’re missing out. After switching to jujutsu, I assure you I don't miss this feature. jj takes the opposite approach. It keeps staging things, and you use split whenever you want to separate things out. (And yes, it stores the staged changes as revisions, so you can always back out to a previous staged state).
I did finally add jj-hunk to my AGENTS.md, and it's now a sizable set of instructions, to my chargrin. I haven't spent the time yet to trim it down but that's coming. I do think that as nice as jj is, the git add -p and git rebase -i are both still tools that base jj could do much better on, that people rightfully are going to miss & feel absolutely stranded, bereft, alone for when they are not there. They are just v…
Can you elaborate? I don't know any reason I would prefer `git rebase -i` over jujutsu. Do you have an example?
(Ditto for `git add -p`)
Re: Staging patches with git add (2024)
#44Earlier quoted context omitted.
The per-line staging in magit is a frequent tool I use. I can be in the middle of bunch of other changes, change 1 line for a different reason that would otherwise be "mid-hunk", and the stage & commit it with its own explanation. It releases me from having to have the "discipline" to stay 100% focused on the broader task at hand and say "hmm, I should fix that while I'm here", without co-mingling purposefully differ…
git add -p or git add ‹file› -p
Re: Staging patches with git add (2024)
#45Re: Staging patches with git add (2024)
#46Earlier quoted context omitted.
> jj takes the opposite approach. It keeps staging things, and you use split whenever you want to separate things out. You can use `git reset -p` to selectively unstage hunks the same way if you wanted to.
I've used git for many years and never remembered the command `git reset -p`. I'd have to look it up. Since that's a pain, I simply didn't. Whereas with jujutsu, after learning it once, I never looked up `split`. And it's not like I use `split` often. I can go weeks without it.
Re: Staging patches with git add (2024)
#47Earlier quoted context omitted.
I've used git for many years and never remembered the command `git reset -p`. I'd have to look it up. Since that's a pain, I simply didn't. Whereas with jujutsu, after learning it once, I never looked up `split`. And it's not like I use `split` often. I can go weeks without it.
i've always thought one of git's strengths is offering robust aliasing and subcommand flexibility. why not spend three seconds making git have split too?
Easier to just use jujutsu. It has a lot of benefits than just this.
Re: Staging patches with git add (2024)
#48Earlier quoted context omitted.
I did finally add jj-hunk to my AGENTS.md, and it's now a sizable set of instructions, to my chargrin. I haven't spent the time yet to trim it down but that's coming. I do think that as nice as jj is, the git add -p and git rebase -i are both still tools that base jj could do much better on, that people rightfully are going to miss & feel absolutely stranded, bereft, alone for when they are not there. They are just v…
> I do think that as nice as jj is, the git add -p and git rebase -i are both still tools that base jj could do much better on, that people rightfully are going to miss & feel absolutely stranded, bereft, alone for when they are not there Can you elaborate? I don't know any reason I would prefer `git rebase -i` over jujutsu. Do you have an example? (Ditto for `git add -p`)
I don't need cli tools. It's basically a spreadsheet of history that can be directly modified, specified.
Re: Staging patches with git add (2024)
#49Earlier quoted context omitted.
> jj takes the opposite approach. It keeps staging things, and you use split whenever you want to separate things out. You can use `git reset -p` to selectively unstage hunks the same way if you wanted to.
I've used git for many years and never remembered the command `git reset -p`. I'd have to look it up. Since that's a pain, I simply didn't. Whereas with jujutsu, after learning it once, I never looked up `split`. And it's not like I use `split` often. I can go weeks without it.