-
The FAQ says that:
However, the FAQ does not explain why this is. What advantages does this confer? Coming from Git, this has always seemed very odd to me. I'm sure there's a good reason for it, but I haven't quite been able to figure out what it is. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 16 replies
-
The first thing that comes to mind is that if you have a PR consisting of several commits In Git, you'd have to either 1) create and name a temporary bookmark at B and switch to it or 2) enter the "detached HEAD" state, e.g. So, the benefit of not having the current bookmark is that you don't need to create as many temporary branches in such workflows, and that there's no need to have separate "detached HEAD" state. One hope of OTOH, if you only ever need to edit commits that are at the tips of branches, you won't see as many advantages. The danger here is that PRs can become a history of every fixup the author needed to make to the first draft of their work, and this can be difficult for another person to review. This might be more of a problem for some projects/repositories than others; it's not much of a problem for a personal repository that one person is working on, for example. |
Beta Was this translation helpful? Give feedback.
-
Can I turn the question around: Why does git require a current branch? It's possible to check out an arbitrary commit, it just puts you in a detached HEAD state. So, it's not a hard requirement. The main reason is that any commit not reachable from a branch is considered "dangling". As soon as you check out a different commit, POOF, it's no longer visible in the log. This is why it's usually problematic to commit with a detached HEAD. What if git didn't automatically drop dangling commits? What if they remained visible in
That sounds a lot like jj to me. |
Beta Was this translation helpful? Give feedback.
-
That FAQ answer might be a case that should not have changed "branch" to "bookmark". |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick answers, all. I was actually requesting that information on this be added to the jj FAQ, but this is perhaps a good starting point. |
Beta Was this translation helpful? Give feedback.
I agree that this is a downside. Different people have different approaches here. We haven't figured out one perfect solution for everybody that preserves the upsides I described in my original message. However,
jj tug
recommended by @TeofilC helps.jj bookmark move -r
might be easier than finding the bookmark's name.jj bookmark move
when I change my mind about how many…