Remix.run Logo
joshka 16 hours ago

Some techniques for this are covered in: https://docs.jj-vcs.dev/latest/FAQ/#how-can-i-keep-my-scratc... and https://docs.jj-vcs.dev/latest/FAQ/#how-can-i-avoid-committi...

tinodb 6 hours ago | parent | next [-]

The work needed for the “I included something in a commit I want split out” [0] seems really complex, and it is something I do often.

Eg with stacked git (stg) this is just: goto, spill, and then refresh/create the stuff I want.

[0] https://docs.jj-vcs.dev/latest/faq/#i-accidentally-changed-f...

martinvonz 5 hours ago | parent [-]

You can do that with just `jj split` too. The FAQ entry you linked to is for when you accidentally amended a commit and now you want to restore the bookmark to the old commit and move the changes you amended into a new commit on top instead.

1718627440 2 hours ago | parent [-]

Sounds like "git reset" to me. Not sure, if it is, but this sounds to be easier in git.

martinvonz an hour ago | parent [-]

I have used both Git and jj. I find it easier in jj.

`git reset` by itself doesn't split a commit AFAIK. You need to then `git add -p` and `git commit` (and recover the commit message from the old commit). And what happens if you had other changes in the working copy first? Or if you want to split a commit that's not at HEAD?

1718627440 an hour ago | parent [-]

> `git reset` by itself doesn't split a commit AFAIK. You need to then `git add -p` and `git commit`

If you want to generate two commits with the exact same message, then do:

    git checkout combined-commit
    git reset --soft previous-version
    git commit -C @
> And what happens if you had other changes in the working copy first?

Do something with them. Put them in a commit, put them into a commit in the global stack of todo commits or tell git to do that automatically.

> Or if you want to split a commit that's not at HEAD?

Check it out or do a rebase.

martinvonz 32 minutes ago | parent [-]

Those were rhetorical questions. I know how to use Git. Sorry that I was unclear.

1718627440 a few seconds ago | parent [-]

> `git reset` by itself doesn't split a commit AFAIK.

Git reset splits a single commit, into two "things", another commit with the first part and a second part that is put into a version prepared for a commit (--soft), prepared for further editing (--mixed) or thrown away (--hard). To me that counts as commit splitting, but it may not match with JJ terms. Also splitting into two commits with the same commit message doesn't sound quite useful to me, so the default of Git two require a second commit message is sensible to me.

> Those were rhetorical questions.

Ok, but then what was your point?

benoitg 15 hours ago | parent | prev [-]

I’m the same as the parent, auto-track = none() works perfectly for me