Live data from Hacker News

Staging patches with git add (2024)

simonholywell.com

51–54 of 54 posts

Re: Staging patches with git add (2024)

#51
Ive got a tendency to modify many things as I go and break them into commits later. Generally I do git add -p until things are too interwoven. In that case, I've ended up with the following strategy:

git commit -m "WIP" & git revert HEAD & git revert HEAD & git reset HEAD^

Now I've got a copy of the changes as a commit and I'm my work tree. I widdle it down until its one change only. Then I do:

git commit -m "Bla" & git rebase -i HEAD~3 -X theirs

Them order Bla above WIP. I keep doing this "double revert" trick until the WIP no longer applies. Then done.

Re: Staging patches with git add (2024)

#52
post #19

Earlier quoted context omitted.

I've sadly had to back out of using jj after leaning into LLM coding assistance, as, even with an extremely well-written jj guide in its context (and literally blocking the use of git ), it never failed to screw things up more than if I was just using git (I call this an "LLMpedance mismatch" problem) If LLM coding assistance continues to increase, it's going to be a rather large speed bump to cross One of the bigges…

I don't let LLMs make commits for me - git or jj. OK, OK - I lie. For personal projects I do - some handle jj decently well. But at work I don't let it make any commits ... and it never tries to. What tools are you using that won't work with detached heads?

I have a lot of things that are built around git already- such as my very commandline, which shouts in bright red if we are on DETACHED HEAD.

I know WHY detached heads happen when using jj (from git's perspective); that doesn't mean I have to LIKE it. Why can't interim worktree commits just use the most-recent bookmark, which is 99% of the time what you'd likely want anyway, is easily movable if it's not, and keeps all Git tooling (as well as old Git users like me) from getting confused?

I've been letting LLMs make commits for many months now. Perhaps that's the "problem" in my case, and why LLMs' incomplete "mental" model of jj seems to cause issues. You wouldn't see the problem if you are still manually committing. (Also, WHY are you still manually committing? LLMs are pretty great now at git committing, at least!)

Re: Staging patches with git add (2024)

#53
post #19

Earlier quoted context omitted.

I don't let LLMs make commits for me - git or jj. OK, OK - I lie. For personal projects I do - some handle jj decently well. But at work I don't let it make any commits ... and it never tries to. What tools are you using that won't work with detached heads?

I have a lot of things that are built around git already- such as my very commandline, which shouts in bright red if we are on DETACHED HEAD. I know WHY detached heads happen when using jj (from git's perspective); that doesn't mean I have to LIKE it. Why can't interim worktree commits just use the most-recent bookmark, which is 99% of the time what you'd likely want anyway, is easily movable if it's not, and keeps a…

> such as my very commandline, which shouts in bright red if we are on DETACHED HEAD.

Fix the command line. Mine just shows the git hash, and the color is only red if there's an uncommitted diff. It doesn't care if I'm in a detached head.

> Also, WHY are you still manually committing? LLMs are pretty great now at git committing, at least!)

I like to control the shape of my commit log.

Re: Staging patches with git add (2024)

#54
post #47

Earlier quoted context omitted.

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?

And do that on every machine? Easier to just use jujutsu. It has a lot of benefits than just this.

[deleted]
Post reply on HN