-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: branch: add "move" command that can update branches by revset or name #3895
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but maybe @arxanas and @emesterhazy have opinions
This is a clever command! I'm slightly worried people might confuse it with Re the commit message:
Was the As I commented in #3884, I'm not immediately sure whether this helps with that issue. |
I'm assuming here non-editing workflow that the
My typical workflow is to create many commits on anonymous branch, and move the branch pointer (e.g. |
Ah, I see. You are relying on the behavior of |
This basically backs out 8706fad "cli: inline check for non-fast-forwardable branch move." I'm going to add another subcommand that moves existing branches.
… name This basically supersedes the current "branch set" command. The plan is to turn "branch set" into an "upsert" command, and deprecate "branch create". (jj-vcs#3584) Maybe we can also add "branch set --new" flag to only allow creation of new branches. One reason behind this proposed change is that "set" usually allows both "creation" and "update". However, we also need a typo-safe version of "set" to not create new branches by accident. "jj branch move" is useful when advancing ancestor branches. Let's say you've added a couple of commits on top of an existing PR branch, you can advance the branch by "jj branch move --from 'heads(::@- & branches())' --to @-". If this pattern is super common, maybe we can add --advance flag for short. One drawback of this change is that "git branch --move" is equivalent to "jj branch rename". I personally don't find this is confusing, but it's true that "move" sometimes means "rename".
A quick summary of my thoughts at the moment (mainly so that I don't feel like I'm slowing this down):
|
Thanks, I'll merge this as is.
I don't have strong opinion about that either. My thinking is as follows:
Anyways, this is the discussion belonging to #3584. I'll post comments or small incremental PRs there. |
Thanks again for implementing this, it's a cool idea!
I agree that having both
I think I agree that If the implementation cost is not too steep, I think the UI will still feel better if it warns or errors in the case when the new branch is (possibly unexpectedly) already tracking remotes. Then, it might as well be called
We could just have |
To me, "create" implies more guarantee and should fail whereas "set"/"rename" can warn, but yeah, it's just feeling. Implementation-wise, there aren't much difference between error and warning.
"tag move" sounds a bit odd to me, but again, it's just feeling. Maybe because moving tags means fixing mistake (so it's more like overwriting than moving)? |
Depending on how much we dislike Alternatively, we could have a notion of "immutable tags" for tags of a certain form, in case people use tags for reasons other than marking releases. I am not sure which is best, but I think there are a bunch of options. |
Checklist
If applicable:
CHANGELOG.md