Git dev分支合併到master分支完美實戰

FeelTouch發表於2018-06-28
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

相關文章