流程如下:
一、将分支切换到master
git checkout master
二、将代码pull到本地
git pull
三、修改冲突
vs工具或者eclipse工具等
四、提交到本地
git add .
git commit -m “merge”
五、切换到你所在分支dev
git checkout dev
六、merge
git merge master
七、将本地内容push到dev分支
git push
aa@aa-PC MINGW64 /f/online-center/cloud/server-functions_services (master)
$ git branch -a #先查看下当前的本地和远程分支
* master
remotes/origin/HEAD -> origin/master
remotes/origin/dev
remotes/origin/master
aa@aa-PC MINGW64 /f/online-center/cloud/server-functions_services (master)
$ git checkout -b my_dev origin/dev #或者是切换到本地的my_dev分支,假如已经存在的话,即git checkout my_dev
Switched to a new branch ‘my_dev’
Branch ‘my_dev’ set up to track remote branch ‘dev’ from ‘origin’.
aa@aa-PC MINGW64 /f/online-center/cloud/server-functions_services (my_dev)
$ git pull #将本地分支my_dev对应的远程分支dev拉下来
remote: Counting objects: 33, done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 33 (delta 11), reused 32 (delta 10)
Unpacking objects: 100% (33/33), done.
From 192.168.5.222:interlive/cloud/server-functions_services
9b3c7c5..dcdb51b dev -> origin/dev
Updating 9b3c7c5..dcdb51b
Fast-forward
content/pom.xml | 24 +-
…/java/com/interlive/services/common/Constant.java | 4 +
…/com/interlive/services/common/RedisClient.java | 7 –
create mode 100644 content/src/test/java/com/interlive/services/controller/ControllerTest.java
aa@aa-PC MINGW64 /f/online-center/cloud/server-functions_services (my_dev)
$ git checkout master #切换到master分支
Switched to branch ‘master’
Your branch is up to date with ‘origin/master’.
aa@aa-PC MINGW64 /f/online-center/cloud/server-functions_services (master)
$ git pull #确保master分支也是最新的
Already up to date.
aa@aa-PC MINGW64 /f/online-center/cloud/server-functions_services (master)
$ git merge my_dev #执行合并的关键代码,此时执行结果时将本地的my_dev合并到本地master分支
hint: Waiting for your editor to close the file… Auto-merging content/src/main/java/com/interlive/services/common/Constant.java
Merge made by the ‘recursive’ strategy.
content/db/.sql | 34 +++++++++
…/java/com/interlive/services/common/Constant.java | 4 +
16 files changed, 490 insertions(+), 9 deletions(-)
create mode 100644 content/src/main/java/com/interlive/services/controller/Controller.java
aa@aa-PC MINGW64 /f/online-center/cloud/server-functions_services (master)
$ git push origin master #将合并的本地master分支推送到远程master
Counting objects: 16, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (16/16), 1.48 KiB | 504.00 KiB/s, done.
Total 16 (delta 9), reused 0 (delta 0)
To 192.168.5.222:interlive/cloud/server-functions_services.git
d970c11..edaa065 master -> master