E:\phpStudy\WWW\vr>git branch -a
dev
master
* hua
remotes/origin/HEAD -> origin/master
remotes/origin/dev
remotes/origin/master
E:\phpStudy\WWW\vr>git status
On branch hua
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)
modified: common/modules/dicinea/restsapi/server/FilmsLogic.php
no changes added to commit (use "git add" and/or "git commit -a")
E:\phpStudy\WWW\vr>git add common
E:\phpStudy\WWW\vr>git commit -m "提交描述"
[hua 15e81f2b] 提交描述
1 file changed, 222 insertions(+)
//就在这儿,忘了切换分支,直接拉取代码了!!
E:\phpStudy\WWW\vr>git pull origin dev
remote: Counting objects: 43, done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 43 (delta 34), reused 0 (delta 0)
Unpacking objects: 100% (43/43), done.
From git.coding.net:vsfor/vr
* branch dev -> FETCH_HEAD
ddbf2b34..0cd6236b dev -> origin/dev
Merge made by the 'recursive' strategy.
.../controller/ShipmentScopeControllers.php | 3 +-
common/modules/dicinea/restsapi/logics/OrderLogic.php | 84 ++++++++++-
2 files changed, 291 insertions(+), 13 deletions(-)
//这儿切换分支
E:\phpStudy\WWW\vr>git checkout dev
Switched to branch 'dev'
//又切换过来了
E:\phpStudy\WWW\vr>git checkout hua
Switched to branch 'hua'
//然后直接就合并了(在本地)
E:\phpStudy\WWW\vr>git rebase dev
First, rewinding head to replay your work on top of it...
Applying: update dicines api film order bug, hua;
Applying: update for dici product scopes limit logics,hua
Applying: update pro scope limit handle logic,hua
Applying: update for wang data sync logic,hua
Applying: modify film return data order by asc,hua
E:\phpStudy\WWW\vr>git checkout dev
Switched to branch 'dev'
//切换到远程,合并出错---杯具啊!(全程飙红,警惕一下)
E:\phpStudy\WWW\vr>git merge hua
Updating ddbf2b34..aa560997
Fast-forward
.../controllers/ShipmentScopeController.php | 3 +-
common/modules/dicinea/restsapi/logics/FilmLogic.php | 2 +
common/modules/dicinea/restsapi/logics/OrderLogic.php | 84 ++++++++++-
common/modules/dicinea/src/OrderLib.php | 2 +-
common/modules/dicinea/src/ShipmentScopeLib.php | 157 ++++++++++++++++++++
restsapi/logics/ScopeLogic.php | 50 ++++++-
7 files changed, 293 insertions(+), 13 deletions(-)
E:\phpStudy\WWW\vr>git push origin dev
To git.coding.net:vshuafor/vrhua.git
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to '[email protected]:vsforhua/vrhua.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
E:\phpStudy\WWW\vr>git status
On branch dev
nothing to commit, working tree clean
E:\phpStudy\WWW\vr>git push origin dev
To git.coding.net:vsforhua/vrhua.git
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to '[email protected]:vsforhua/vrhua.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
E:\phpStudy\WWW\vr>git pull origin dev
From git.coding.net:vsforhua/vrhua
* branch dev -> FETCH_HEAD
E:\phpStudy\WWW\vr>git status
On branch dev
nothing to commit, working tree clean
E:\phpStudy\WWW\vr>git push origin dev
To git.coding.net:vsforhua/vrhua.git
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to '[email protected]:vsforhua/vrhua.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
E:\phpStudy\WWW\vr>git pull origin dev
From git.coding.net:vsfor/vr
* branch dev -> FETCH_HEAD
//就是这个错,请看下方
Merge made by the 'recursive' strategy.
//各种找错中.....
E:\phpStudy\WWW\vr>git branch -a
* dev
master
hua
remotes/origin/HEAD -> origin/master
remotes/origin/dev
remotes/origin/master
E:\phpStudy\WWW\vr>git pull origin dev
From git.coding.net:vsforhua/vrhua
* branch dev -> FETCH_HEAD
Already up to date.
E:\phpStudy\WWW\vr>git merge hua
Already up to date.
E:\phpStudy\WWW\vr>git checkout hua
Switched to branch 'hua'
E:\phpStudy\WWW\vr>git status
On branch hua
nothing to commit, working tree clean
E:\phpStudy\WWW\vr>git branch -a
dev
master
* hua
remotes/origin/HEAD -> origin/master
remotes/origin/dev
remotes/origin/master
E:\phpStudy\WWW\vr>git branch -a
dev
master
* hua
remotes/origin/HEAD -> origin/master
remotes/origin/dev
remotes/origin/master
E:\phpStudy\WWW\vr>git checkout dev
Switched to branch 'dev'
E:\phpStudy\WWW\vr>git pull origin dev
remote: Counting objects: 8, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 8 (delta 7), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
From git.coding.net:vsforhua/vrhua
* branch dev -> FETCH_HEAD
0cd6236b..50358682 dev -> origin/dev
Merge made by the 'recursive' strategy.
E:\phpStudy\WWW\vr>git branch -a
* dev
master
hua
remotes/origin/HEAD -> origin/master
remotes/origin/dev
remotes/origin/master
E:\phpStudy\WWW\vr>git checkout hua
Switched to branch 'hua'
//执行git rebase dev
E:\phpStudy\WWW\vr>git rebase dev
First, rewinding head to replay your work on top of it...
Fast-forwarded zhaofw to dev.
E:\phpStudy\WWW\vr>git checkout dev
Switched to branch 'dev'
E:\phpStudy\WWW\vr>git pull origin dev
From git.coding.net:vsforhua/vrhua
* branch dev -> FETCH_HEAD
Already up to date.
E:\phpStudy\WWW\vr>git branch -a
* dev
master
hua
remotes/origin/HEAD -> origin/master
remotes/origin/dev
remotes/origin/master
E:\phpStudy\WWW\vr>git checkout hua
Switched to branch 'hua'
出现“Merge made by the 'recursive' strategy.”,因为在本地提交后没有切换分支,直接pull代码,导致分支切换后拉取、合并出现问题,可在本地分支先执行“git rebase dev”,再切换远程分支pull代码