|
I just realized (with horror) that if track a bookmark and someone force-push that remote git branch to a different commit (that is not a descendant of the previous commit), the next time I run Is there a way to prevent that behavior? If not, that make the bookmark tracking way too dangerous, what would then be the recommended workflow to push to a git remote without tracking bookmarks? |
Replies: 2 comments 3 replies
|
The scenario is less dangerous than it looks, because jj only moves the local bookmark silently in the case where you have nothing at stake there. From
So the branching is on whether your local bookmark has moved since the last fetch:
Which means the case you'd actually want protection from is the one that already has it. On the "I might not notice" part — that's what the operation log is for, and it covers this even in the silent case. Every fetch is an operation, so If you still want the guarantee rather than the audit trail, untracking is supported and is the documented way to do it: jj bookmark untrack <bookmark>@<remote>
You keep pushing with For what it's worth I'd only reach for that on a remote where force-pushes to shared bookmarks are routine. Elsewhere the conflict behaviour plus |
|
I think you can set https://docs.jj-vcs.dev/latest/config/#abandon-commits-that-became-unreachable-in-git |
You're right on the push point and my suggestion doesn't survive it — if
--bookmarkre-establishes tracking, then "untrack and keep pushing that way" quietly undoes itself on the next push. Scratch that part.And
pull.ff onlyis a much better statement of what you want than anything I offered, so let me answer that directly: jj has no equivalent, and it isn't a missing knob so much as a different model. jj doesn't do pull-with-fast-forward-or-merge; it does a three-way merge of the ref targets themselves, described indesign/tracking-branches.mdas "remote changes are merged into the local counterparts", with the last-imported position as the base. When your local hasn't moved, that merge…