简体   繁体   English

如何合并两个分支(本地与远程分支)

[英]How to merge two branches (my local with a remote branch)

I created the branch testDB and I want to pull from the databasecheck , which a colleague's branch, into the former. 我创建了分支testDB,并希望从databasecheck (同事的分支)中拉入前者。

I know that I have first to fetch and then to merge but I do not know how to do it exactly. 我知道我必须先获取然后合并,但是我不知道该怎么做。

So, given the names of the branches that I have to merge can someone show me exactly how to do it ? 那么,鉴于必须合并的分支的名称,有人可以确切地告诉我该怎么做吗?

The simplest way is git pull origin databasecheck while you have your branch checked out. 最简单的方法是在分支被检出时进行git pull origin databasecheck This will fetch from the origin and then merge the origin/databasecheck into your local testDB branch 这将从origin获取,然后将origin/databasecheck合并到本地testDB分支中

You have to switch to the branch you want to merge into (testDB in this case) then run the command git merge databasecheck 您必须切换到要合并到的分支(在这种情况下为testDB),然后运行命令git merge databasecheck

This would merge databasecheck into testDB. 这会将databasecheck合并到testDB中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM