1. 本地branch: DevTest push 到 远程分支: SmokeTest
git push origin DevTest:SmokeTest
失败:
! [rejected] DevTest -> SmokeTest (fetch first)
error: failed to push some refs to 'gitlab.fftech.info:eastern/platform-extensions/sales-channel/store-operation-inspector.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
2.
git pull
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> DevTest
3.
git branch --set-upstream-to=origin/SmokeTest DevTest
branch 'DevTest' set up to track 'origin/SmokeTest'.
4.
git branch -vv
* DevTest 4068103 [origin/SmokeTest: ahead 1, behind 1] improve Tmall Catalogue and Resource Catalogue page
master 8dda247 [origin/master: behind 15] first project
5.
git push origin DevTest:SmokeTest 再次报错:
! [rejected] DevTest -> SmokeTest (non-fast-forward)
error: failed to push some refs to 'gitlab.fftech.info:eastern/platform-extensions/sales-channel/store-operation-inspector.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
尝试:
6.
git checkout SmokeTest
7.
git merge DevTest
Merge made by the 'ort' strategy.
8.
git checkout Smoketest
9.
git checkout DevTest
Switched to branch 'DevTest'
Your branch and 'origin/SmokeTest' have diverged,
and have 1 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
10.
git pull
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint: git config pull.rebase false # merge
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
10.
git rebase origin/SmokeTest
Successfully rebased and updated refs/heads/DevTest.
11. git status
On branch DevTest
Your branch is ahead of 'origin/SmokeTest' by 1 commit.
(use "git push" to publish your local commits)
12.
git push origin DevTest:SmokeTest
成功
标签:origin,SmokeTest,git,DevTest,branch,push From: https://www.cnblogs.com/pangniu/p/17620743.html