-
Notifications
You must be signed in to change notification settings - Fork 126
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
west update: consider recommending git rebase --onto
instead
#448
Comments
@mbolivar-nordic I suggested the three ref form, but I didn't have a good way to find the needed second ref. I made the suggestion before I realized that i was on a branch from zephyrproject-rtos/zephyr, but in the context of NCS, so west update changed to a branch in nrfconnect/sdk-zephyr. I cannot think of a better suggestion for this scenario other than the first commit on |
Can someone confirm this issue is specifically about a "volatile" manifest-rev where the old manifest-rev is not a parent of the new manifest-rev? AND the old commits have been superseded by slightly different new commits, so the current rebase advice will most likely cause a conflict between old and new upstream? If I got this starting point wrong then you should probably ignore half of what I wrote below. Which half is left as an exercise for the reader :-) Volatile/mutable branches make everything more complicated, I wish git had a way to label them
I don't see how that can achieve any desired effect. I tried this on a toy example and as expected it seems to rebase the new commits on top of themselves. This had no effect.
It may not have examples but I'm pretty sure it is documented, from
Every time I look at So the "two refs argument" form translates to: As for many other git commands, the For some sanity I'm omitting the git rebase feature that also switches branch for "convenience"... and more confusion.
BTW I often git branch --set-upstream-to manifest-rev Never tried it with a volatile manifest-rev though. |
In the case of a volatile manifest-rev I don't think it's possible to do anything without the old manifest-rev. Without the old manifest-rev nothing can draw a line between old upstream commits versus local commits. This is the exact equivalent of a manifest-rev force-push.
You could try the reflog of manifest-rev |
I meant automatically, in the script :) |
Sorry: which script? I meant you could suggest I agree I would be very reluctant to use any relog in any automation. |
Confirmed, and thanks for the explanation; that was useful.
The nice thing about |
Currently,
west update
prints a message whenever a checked out branch is left behind that recommends rebasing onto the new HEAD withgit -C relative/path/to/repo rebase NEW_HEAD left-behind-branch-name
.This doesn't work well if the new head rebased from the old manifest-rev, as it brings along the old commits.
@joerchan noted that
git .. rebase --onto NEW_HEAD left-behind-branch-name
might be a better recommendation in this case. This "two ref argument" form of--onto
is not documented in thegit rebase
manual as far as I can tell; the manpage just has examples which dogit rebase --onto NEW_HEAD ref1 ref2
, with three refs total including NEW_HEAD instead of just two.Needs more investigation to see if we can make a better recommendation to rebase just the commits that were on top of the old manifest-rev via
--onto
or otherwise.It occurs to me while writing this that
west update
knows the old and newmanifest-rev
commits, so it can probably create a "three-argument"--onto
invocation with those.cc:
The text was updated successfully, but these errors were encountered: