Replies: 2 comments
-
Were there any changes made on the remote in this scenario? If not, the $ jj checkout foo
# @ y (empty) (no description set)
# |
# o x foo
$ jj commit -m blah
$ jj branch set foo -r @-
# @ z (empty) (no description set)
# |
# o y foo blah
# |
# o x foo@origin
$ jj git push
# @ z (empty) (no description set)
# |
# o y foo blah
$ jj git fetch
# @ z (empty) (no description set)
# |
# o y foo blah
$ jj checkout foo
# @ w (empty) (no description set)
# |
# o y foo blah The only thing that happened in the last $ jj git fetch
# o w foo
# |
# | @ z (empty) (no description set)
# |/
# o y blah
$ jj checkout foo
# @ v (empty) (no description set)
# |
# o w foo Does that clarify? I think our planned |
Beta Was this translation helpful? Give feedback.
-
Yes, that's what I was trying to explain here:
If there are no changes on the remote, the Automatic rebasing would indeed have the correct behavior, though technically no commits should be rewritten as long as the working state is clean; it should be a purely "fast-forward" merge, to use the git term. |
Beta Was this translation helpful? Give feedback.
-
jj git fetch
has some behavior that surprised me at first, but makes sense becausejj
doesn't have tracking branches. After the following sequence of operations, the working copy does not have any new changes from the remote, and any new commits will create a fork in history:To avoid this,
foo
must be checked out again.This doesn't matter if the local workspace is the only place where changes are being introduced along this branch, but even when branches aren't shared between developers, sometimes it's useful for CI to automatically create commits on a branch (e.g. if the CI process includes some kind of code-gen and the generated code is committed to the repository, as is I believe is typical with
protoc
andgo gen
). So here's the more awkward version of the above:Here,
@
is empty when performinggit
operations, so there's no reason for a fork in history; and at no point did the user decide to work on a different branch or conceptual line of work. So thejj checkout foo
at the end feels quite redundant.This is pretty similar to previous discussions about auto-updating branch heads, but I don't think it's been explicitly called out before.
Beta Was this translation helpful? Give feedback.
All reactions