endtime 6 days ago

I have more or less been using the squash workflow, but nevertheless, remembering to do `jj new` before doing anything else is a challenge. Might just get used to it with more time.

1
cobyte8 4 days ago

Hmm, maybe I'm missing something, but you can use the squash workflow so that you don't have to remember to start a new commit: you're always at an empty commit when you context switch to repo.

* If you `git clone ...` and then `jj git init --colocate`, you're in a new commit (whose parent is the HEAD of the git repo).

* If you write some code and then `jj commit`, you're now in a new commit.

* If you want to work on top of commit zyx instead, you can run `jj new zyx` (not `jj edit zyx && jj new`).

* If you're done for the day, you can `jj commit -m "temp: it kinda works, I'll take another stab tomorrow"` and you're on a new commit again.

In many ways, this reflects the normal git workflow (if you want something checkpointed, you've "commit"ed it). This does mean that while I'm in the middle of working on something, I have some commits that aren't split by logic but by chronology. So instead of one commit ("make foo"), I'll have three commits ("try to make foo", "eh, didn't work, try again", "fix bar so that foo actually works now") that reflect my process rather than logic. Once I'm convinced that I finally did it right, jj makes it easy to squash/manipulate the commits into the logical units I want to present in my PR (or record in my history for personal projects).