git rebase from master to remote branch.! -


i googled, , read many document. unfortunately cannot understand them all

my situation is.

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 

and merge every patches master remote mybranch.

i tried

git checkout team/myteam

git rebase master

git status on branch team/myteam  branch , 'origin/team/myteam' have diverged, , have 238 , 18 diffrent commits each, respectively. nothing commit, working directory clean 

it seems works.. push returns error..

i use gerrit.

git push origin head:refs/for/team/mybranch   ... .. remote: resolving deltas: 100% (14481/14481) remote: processing changes: refs: 1, done ssh://156.xxx.xxx.xxx/xxx  ! [remote rejected] head -> refs/for/team/myteam (change 228 closed)  error: failed push refs 'ssh://156.xxx.xxx.xxx/xxx 

i assume want push origin/team/myteam , date in team/myteam.

if rebase team/myteam master, rewriting history of branch team/myteam git doesn't allow push conflicts history has in origin/team/myteam.

if sure of want (rewrite history on origin repo), can force push :

 git push --force 

beware team mates might have troubles when pull origin/team/myteam : rewriting shared history not recommended.

you might want merge instead of rebase : in case can simple push , skip potential troubles.


Comments