本文介绍了手动合并合并请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b $ 1)我从mainbranch创建了一个新分支,并命名为userstory1



2)我在分支userstory1中推送了我的更改,并向我的同事提出了一个pull请求。

3)他发现文件夹结构不正确,因此将其重命名为my代码文件夹在mainbranch中。所以现在我在userstory1分支上有文件夹mycode,而在mainbranch上有它的名为my-code。我的分支userstory1上的更改尚未合并到mainbranch中4)当然,现在我的pull请求的自动合并在mainbranch上是不可能的。



处理这种情况的最佳方法是什么?我想使用相同的pull请求来合并分支userstory1到mainbranch的更改



我想到的是从mainbranch获取代码并将其提交给我的机器分支userstory1但不能确定是否可以使用相同的pull请求,如果我在userstory1分支上做更多提交的话

解决方案


结帐userstory1

  git checkout userstory1 

现在合并mainbranch

  git merge --no-ff mainbranch 

它会告诉你冲突。
清楚地看到类型

  git status 
现在请手动解决冲突,然后键入

/ p>

  git commit 

如果您想添加消息,则取决于您的其他方面,它会改变上一个消息。

然后推代码

假设起源为:$ b

  git push origin userstory1 

远程网址。

无需执行任何操作,即可自动更新。

So I have following situation in github.

1) I created a fresh branch from the mainbranch and named as userstory1

2) I pushed my changes in branch userstory1 and raised a pull request to my colleague

3) He saw that folder structure was not correct so renamed my code folder in mainbranch. So now I have folder mycode on userstory1 branch whereas on mainbranch its named my-code. My changes on branch userstory1 are yet to be merged to mainbranch

4) Of course now automatic merge of my pull request is not possible on mainbranch

What is the best way to handle this situation? I want to use the same pull request for merging changes on branch userstory1 to mainbranch

What I have thought of is to get the code from mainbranch onto my machine and commit it to branch userstory1 but not sure if same pull request can be used if I do more commits on userstory1 branch

解决方案

There are many ways First Is

checkout userstory1

git checkout userstory1

Now merge mainbranch

git merge --no-ff mainbranch

It will show you the conflict.To see clearly type

git status

and pay attention for the files that are changed on both side.

Now resolve the conflict manually and then type

git commit

If you want to add message it's upto you other wise it will ammend to previous one

then push the code

git push origin  userstory1

assuming origin as remote url.

No need to do anything with pull-request it will automatically updated.

这篇关于手动合并合并请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-10 05:29