[英]How Can I replace/copy all file and folder from one branch to another existing branch in GIT
I have 3 branch -> Master
, develop
and admit_card
. 我有3个分支->
Master
, develop
和admit_card
。 I had created before admit_card
from the develop
branch. 我是在
develop
分支的admit_card
之前创建的。 I always made changes on admit_card
branch and merge it into develop
. 我一直在做改变
admit_card
分支并将其合并到develop
。
But suddenly I have changed some more files and also deleted folder form the develop
branch. 但是突然之间,我更改了一些文件,还从
develop
分支中删除了文件夹。 And now I want to copy/keep updated to the admit_card
branch like develop
branch (By deleting folders and files). 现在我想复制/保持更新到
admit_card
像分支develop
分支(通过删除文件夹和文件)。
I merged it with develop
branch. 我将其与
develop
分支合并。 It is merging with develop
branch properly. 它正在正确地与
develop
分支合并。 But the issue is the folders and files I deleted from the develop
branch is still showing into the admit_card
branch. 但是问题是我从
develop
分支删除的文件夹和文件仍然显示在admit_card
分支中。
here is the merge develop branch with admit_card
branch. 这是带有
admit_card
分支的合并开发分支。
git checkout admit_card
git merge develop
what should I do please? 我该怎么办? How can I copy/replace exact
develop
branch to admit_card
branch? 如何将确切的
develop
分支复制/替换为admit_card
分支? Can anybody please help me? 有人可以帮我吗?
Thank you 谢谢
I think rebase
is better approach here. 我认为在此重新设置
rebase
是更好的方法。
On your admit_card
branch run 在您的
admit_card
分支上运行
git rebase develop
This will, in effect, set your admit_card
branch to the contents of the develop
branch and then play back any additional commits on the admit_card
branch on top of this. 这实际上将设置你的
admit_card
分支的内容develop
分支,然后回放任何额外提交的admit_card
分支在此之上。 You might have merge conflicts if you have touched the same files in both the branches. 如果您在两个分支中都触摸了相同的文件,则可能会有合并冲突。 Once you resolve the merge conflicts, your
admit_card
branch will be a clean topic branch on top of your develop branch again. 解决合并冲突后,您的
admit_card
分支将再次成为位于develop分支顶部的干净主题分支。
Run git rebase --abort
if you get stuck with the merge to revert back to how things were. 如果遇到合并问题,请运行
git rebase --abort
以恢复到原来的状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.