GIT:如何将一个分支的内容复制到其他分支? [英] GIT: How to copy contents of one branch to other branch?

查看:2604
本文介绍了GIT:如何将一个分支的内容复制到其他分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有'开发'和'InitialPomChanges'分支。我想将开发分支的所有内容复制到InitialPomChanges分支。

您可以使用 git merge 或 git rebase



如果你在InitialPomBranch上,你可以简单地运行

  git merge develop 

  git rebase develop 

第一个将合并开发分支的所有提交到InitialPomBranch。第二个将把开发分支的所有提交置于InitialPomBranch的第一个提交之下。编辑:Rebase将更改InitialPomBranch的所有提交的SHA哈希值。所以你必须运行

  git push -f origin InitialPomBranches 

推送所有更改


I have 'develop' and 'InitialPomChanges' branches. I want to copy all the contents of develop branch to InitialPomChanges branch.

解决方案

You can use git merge or git rebase

If you are on the InitialPomBranch, you can simply run

git merge develop

or

git rebase develop

The first one will merge all the commits of the develop branch on to InitialPomBranch. The second one will put all the commits of the develop branch below the first commit of the InitialPomBranch

Edit: Rebase will change the SHA hashes of all the commits of the InitialPomBranch. So you will have to run

git push -f origin InitialPomBranches 

to push all the changes

这篇关于GIT:如何将一个分支的内容复制到其他分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆