简体   繁体   English

Git从分支A迁移到B

[英]Git rebase from branch A to B

I have two branches, Master and Develop. 我有两个分支,Master和Develop。 I will like to "copy" the content of Develop in Master so: 我想“复制” Master中的Develop的内容,因此:

Master <- Develop

According to documentation: 根据文档:

git rebase <base>

Rebase the current branch onto base, which can be any kind of commit reference (an ID, a branch name, a tag, or a relative reference to HEAD). 将当前分支重新设置为base,可以是任何类型的提交引用(ID,分支名称,标记或HEAD的相对引用)。

But Im not very sure about the terminology, if I check out to Master and from there i do git rebase develop am I coping everything from develop to master or the other way? 但是我对术语不是很确定,如果我向Master结帐,然后从那里进行git rebase development,我是否可以应对从develop到master的所有问题?

git rebase X means: git rebase X意思是:

move the commits of the current branch on top of branch X . 将当前分支的提交移动到分支X 顶部

In your case: 在您的情况下:

git checkout Develop
git rebase master

But if you don't want to change the history of Develop (for instance, if Develop was already pushed to a remote repo), a simple git merge is enough. 但是,如果您不想更改Develop的历史记录(例如,如果Develop已经被推送到远程仓库),那么简单的git merge就足够了。

git checkout master
git merge Develop

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

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