| ▲ | embedding-shape 10 hours ago | ||||||||||||||||||||||||||||
> Just don't ever use `edit`, use `new` instead As a git-ist (?), if I'd ever move away from git, it would be to avoid tooling that has idioms like this (like git too has), if `jj` just gonna surface a bunch of new "bad ideas" (together with what seems like really good ideas), kind of makes it feel like it isn't worth picking up unless you don't already know git. | |||||||||||||||||||||||||||||
| ▲ | rtpg 35 minutes ago | parent | next [-] | ||||||||||||||||||||||||||||
"jj new" is like "I'm going to make some changes", then you do "jj squash" to say "OK these look good enough to commit". If you work this way you're "always" in a WIP state. And if you switch to another spot you won't lose your work, cuz it's persisted. The end result if you work like this is you don't need stashing, since you get "free" stashing in your commit tree, which is more likely what people want (and if it's not... rebasing is easy so just move the node/`jj duplicate` it!) `jj edit` exists but I think it's just not what people want in the default case at all. In exchange: rebasing "just works", stashing is not a thing to think about, and you don't lose your work | |||||||||||||||||||||||||||||
| ▲ | saghm 9 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||
The idiom here is use `edit` if you want to edit a commit, and use `new` if you want to make a new commit. This works identically whether you specify the commit via branch name or commit id. I'm not sure why people are saying not to use `edit` ever. It's basically just a shorthand for staging and amending changes in an existing commit, and there's still a use case for that; it's just not "I want to see the changes on this old branch". | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| ▲ | dzaima 10 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||
`edit` is still useful; just, for ..editing (!) something, instead of viewing it. If you have some unfinished changes at the tip and want to temporarily checkout something 2 weeks ago, you `jj new` to there (similar to `git stash; git switch whatever`), and then later `jj edit your-old-tip` to go back (equivalent to `git switch main; git stash pop`; I think `jj edit` being an extended replacement for stash-popping things is a reasonable way to think about it). (and if you don't have any uncommitted changes, you always `jj new`) jj also has a concept of immutable commits (defaulting to include tagged commits, and trunk at origin, which it'll disallow editing as a layer of defense) | |||||||||||||||||||||||||||||
| ▲ | surajrmal 10 hours ago | parent | prev [-] | ||||||||||||||||||||||||||||
jj edit has good use cases, but it's not the default command you need. For instance, say you were working on some changes but had to change branches for a few minutes to do something. If you didn't manage to create a commit and want to go back to the previous staging area, you would use the jj edit command rather than jj new. It's very intuitive in my experience, something I can't say is true for managing git commits (unless you've spent years forcing it into muscle memory). I never need to run jj help. I run help commands with git all the time. | |||||||||||||||||||||||||||||