合并开发分支到主

时间:2016-04-12 10:12:46

标签: git merge

我有一个包含2个分支masterdevelop的本地仓库。

  • develop分支中我拥有所有Drupal 8核心代码
  • 在我的master分支中,我有1个提交(初始提交)

在我的远程仓库中,我将所有Drupal 8核心代码放在分支develop中。如何在远程主分支中获取此代码?我如何合并这些回购?

更新

当我git status时,我得到:

On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    griffioenrotterdam.sublime-project
    griffioenrotterdam.sublime-workspace
    sites/

nothing added to commit but untracked files present (use "git add" to track)

我该怎么做?

更新2:

当我git checkout develop时,我得到:

error: The following untracked working tree files would be overwritten by checkout:
    sites/default/default.services.yml
    sites/default/default.settings.php
Please move or remove them before you can switch branches.
Aborting

我该怎么做?

4 个答案:

答案 0 :(得分:26)

总结:您需要切换到您的开发分支,从远程仓库中提取代码,然后将其合并到master(本地)并将其推回远程仓库(进入主分支)

git checkout develop
git pull origin develop
git checkout master
git merge develop
git push origin master

答案 1 :(得分:5)

将本地开发合并为master然后再推送

git checkout master
git merge develop
git push

答案 2 :(得分:1)

首先将更改提交给master

 git checkout develop
 git pull origin develop
 git checkout master
 git merge develop
 git push origin master

答案 3 :(得分:0)

我认为该过程是使用git pull请求从dev(remote)合并到master(remote)。