Git repo sync error: branch XYZ is published (but not merged) and is now 1 commits behind
I had submitted two patchsets for a change, the first with "git commit -s", and the subsequent with git commit --amend -s". After the review of second patchset, was asked to make some more modifications for an improvement. The overall change/patch itself is pending approval, and has not yet been merged.
I made the modificatione needed, and did “git add” on 6 (6 files had changed since the last patchset) of the total 7 files that are part of the change, and did a "git commit -- amend -s". I did a "repo sync", no errors, but did not "repo upload" yet.
Then I remembered that one of the files had been set incorrectly with non-default values for two debug flags in the above commit. So I went back and changed that one file again, then did an “git add” of that one file, and a “git commit --amend -s”, which went through withour errors, just like the earlier “git add” and “git commit --amend -s” above.
When I did a repo sync a开发者_StackOverflowgain prior to doing the repo upload, I got the following error:
"error: : branch topic1 is published (but not merged) and is now 1 commits behind"
What is the best/easiest way to fix this and do the repo upload?
thanks in advance.
I was just searching for this and happened upon the answer. do "git rebase ". This will reparent your changes to the updated branch. You might need to perform merges as prompted.
Use "repo rebase"
Summary
Rebase local branches on upstream branch
Usage: repo rebase {[...] | -i ...}
Options: -h, --help show this help message and exit -i, --interactive interactive rebase (single project only) -f, --force-rebase Pass --force-rebase to git rebase --no-ff Pass --no-ff to git rebase -q, --quiet Pass --quiet to git rebase --autosquash Pass --autosquash to git rebase --whitespace=WS Pass --whitespace to git rebase --auto-stash Stash local modifications before starting
Description
'repo rebase' uses git rebase to move local changes in the current topic branch to the HEAD of the upstream history, useful when you have made commits in a topic branch but need to incorporate new upstream changes "underneath" them.
精彩评论