-
Notifications
You must be signed in to change notification settings - Fork 354
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
Option to rebase/amend verbatim (like "ours" merge strategy) #1027
Comments
Alternatively, there could be a better way to restore from the pre-rebase version of a rebased commit. It shouldn't be hard to add a revset operator for "go back in the obslog", but I don't know if that will always do the right thing, especially if the idea from #963 (comment) is implemented. |
On the topic of naming, git-branchless calls this |
I like the explanation you have in the docs. I'm not sure So far, the only other idea that came to my mind is |
Also, I kind of like the word "verbatim". Is it confusing in some way? |
I've used the word "reparent" before. I used it because the operation changes the (descendants') parent pointers without changing anything else in the commit (well, it does change the commit signature too).
I wouldn't say it's misleading, it's just not clear to me what it means. It could mean to apply the differences verbatim, although I don't know what that would actually mean. |
I'm not sure I agree, but this makes sense. Another name this made me think of is Idea # 3: Perhaps A related consideration is that for The other versions of rebase would only accept |
My problem with |
Your first sentence here says "causes the rebase to preserve the contents of the commits being rebased" so how about |
"Reparenting" is an alternative to "rebasing", rather than a supplementary mode. Rebasing involves the application of patches, while reparenting means only that the parent edge is updated. My other candidate for an option name was also
All of "reparent", "verbatim", and "preserve" have the problem that they apply to the descendants of the to-be-amended commit, not the commit itself, so none are exactly accurate. A flag name like Of course, there is a simple data-driven solution: deploy all three as aliases to Google internally, collect telemetry on the most common invocation, and use that 😉. |
I've wanted I wonder which other commands should have this option. Here are all our current commands. I've indicated which ones can result in rebasing we a
There's also the auto-rebasing that happens if you're editing a non-head, but I think it's safe to rule that out. The same applies to auto-rebase after resolving conflicts from concurrent operations. I think we can also safely eliminate Finally, some of them already always preserve the descendants' content, which eliminates
I can see it being useful to preserve descendants' contents for each of these. I think we should add this flag we're talking to all of them. I wonder if it should even be a top-level flag (like I think the only existing command that rewrites (non-head) commits in two different places is I think we can implement this feature by adding a |
I'll mention that Git's merge strategies both have an |
I usually want to keep one side completely unchanged, but good point that the |
Regarding naming, how about So, the docs for
Whereas
WDYT? |
It's certainly an interesting idea. I find it to overcomplicate things a lot, but I also think that how complicated someone finds it will depend upon their mental model of a VCS, which if experience has taught me anything, greatly differs from person to person. In my mental model, I switch between thinking of a commit as a tree and as a patch as required, so to me
Obviously, everything I'm saying is my own mental model. My point is that I believe that this decision should be based on:
|
My goal with I feel like many of your suggestions rely on some prior learning from outside-of- Without further context,
I don't like So, if enough people feel like it's intuitive, I'd go with |
I toyed with it in #4489 for |
I tried the same approach with |
There are 3 cases here:
|
Re/ names — has the Maybe it's just me, but I find pretty much all options mentioned here ( The |
Not if you ask me. The flag is new since 0.22.0 (october). We can add flag with a better name and deprecate that old one. |
I think it would be nice for
jj rebase
andjj amend
to have a--verbatim-rebase
option that causes the rebase to preserve the contents of the commits being rebased (as opposed to the diff between them and their parents). Forjj rebase
, this flag could simply be--verbatim
.In hg and git, I think, this is done via the "ours" merge strategy.
Currently, I don't know a non-awkward way to do this. The best way, I think, is to
jj duplicate
the tip of the rebase, then rebase, and thenjj restore --from duplicate
, and finallyjj abandon duplicate
. Or you canjj rebase
, thenjj obslog
and finallyjj restore --from last_obslog_commit
.One example when this is useful is when reordering commits. If there's a conflict in the middle, you'd be able to
jj update middle
, resolve the conflict, and thenjj amend --verbatim-rebase
.The text was updated successfully, but these errors were encountered: