我已经谷歌过并阅读了很多文件,但遗憾的是我不能完全理解它们。
我的情况是:
git branch -r
origin/HEAD -> origin/master
origin/master
origin/team/myteam
git branch -a
master
team/myteam
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/team/myteam
现在我想将主分支上的所有补丁合并到远程分支mybranch
中。
我尝试了:
git checkout team/myteam
git rebase master
git status
On branch team/myteam
Your branch and 'origin/team/myteam' have diverged,
and have 238 and 18 diffrent commits each, respectively.
nothing to commit, working directory clean
看起来工作正常,但push
返回错误。
我正在使用Gerrit。
git push origin HEAD:refs/for/team/mybranch
...
..
remote: Resolving
deltas: 100% (14481/14481) remote: Processing changes: refs: 1, done
To ssh://156.xxx.xxx.xxx/xxx ! [remote rejected] HEAD -> refs/for/team/myteam (change 228 closed)
error: failed to push some refs to 'ssh://156.xxx.xxx.xxx/xxx
git merge
呢? - 1615903merge
代替rebase
,尤其是对于新手来说,我建议使用合并。 - Sébastien Dawans