更新时如何使主叉更改反映在主站中? [英] How to make fork changes reflect with the master when updated?

查看:98
本文介绍了更新时如何使主叉更改反映在主站中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我从Github分叉了一个repo,现在iam拥有2个项目源,其中一个是所有者资源库中的主分支,另一个是我的分支中的主分支。



现在我遇到了这样的问题。



假设在我的项目中有一个像这样的代码的文件自述文件



< h2>主题完成

   -  []介绍
- [] [主题名称(视频)的演变]
- [] [背景故事]
- [] [改进]
- [] [问题]
- [] [包含]

>主题名称(视频)的演变]
- $ x

$ b $ $ $ $ $ $ $ $ $ [] [背景故事]
- [] [改进]
- [] [问题]
- [] [包含]

到这里没有问题,但真正的问题是在完成期间两个主题的原始大师有几个主题的自述文件,它现在看起来像这样。



要完成的主题



   -  []介绍
- [] [主题名称的演变(视频)]
- [] [背景故事]
- [] [新主题-1]
- [] [新主题-2]
- [] [新主题-3]
- [] [改进]
- [ ] [问题]
- [] [包含]

现在我想更新链接和这个命令将不会使用,因为我执行 git fetch upstream 和 git pull upstream master 。

我想在本地仓库中使用自述文件的版本是这种格式。



要完成的主题



   -  [X]介绍
- [X] [主题名称(视频)的演变]
- [] [背景故事]
- [] [新主题-1]
- [] [新主题-2]
- [] [新主题-3]
- [] [改进ments]
- [] [问题]
- [] [包含]

请帮助。

解决方案

除此之外,您应该在专用功能分支,您不应该直接(将 upstream / master 合并到您的 master )



您应该 pull --rebase 更新后的 upstream / master ),然后 git push --force 回到您的分支。



在更新的自述文件中重新提交您的提交后,您应该找回标记。


Suppose i forked a repo from Github now iam having 2 project sources one is the main master branch in owner repository and other is my master branch in my fork.

Now i got a problem like this.

Suppose in my project there is a file Readme with the code like this

Topics to completed

- [ ] Introduction
- [ ] [The Evolution of topic name(video)]
- [ ] [Background story]
- [ ] [Improvements]
- [ ] [Problems]
- [ ] [COnclusion]

So i have forked my repo and after completion of each topic i would mark a X and save the file in my local repo like this.

- [X] Introduction
- [X] [The Evolution of topic name(video)]
- [ ] [Background story]
- [ ] [Improvements]
- [ ] [Problems]
- [ ] [COnclusion]

Upto to here no problem was there,but real problem was during the completion of two topics the original master have few more topics to the Readme file and it looks like this now.

Topics to completed

- [ ] Introduction
- [ ] [The Evolution of topic name(video)]
- [ ] [Background story]
- [ ] [New topics -1]
- [ ] [New topics -2]
- [ ] [New topics -3]
- [ ] [Improvements]
- [ ] [Problems]
- [ ] [COnclusion]

So now i wanted to update the links and this commands will not use because my previous markings will be lost when i execute git fetch upstream and git pull upstream master.

Version of Readme file i want in my local repo is in this format.

Topics to completed

- [X] Introduction
- [X] [The Evolution of topic name(video)]
- [ ] [Background story]
- [ ] [New topics -1]
- [ ] [New topics -2]
- [ ] [New topics -3]
- [ ] [Improvements]
- [ ] [Problems]
- [ ] [COnclusion]

Please help.

解决方案

Beside the fact you should make any evolution in a dedicated feature branch, you should not pull directly (that merges upstream/master into your master)

You should pull --rebase (which replays your local commits on top of the updated upstream/master), and then git push --force back to your fork.

You should get back your markers after re-applying your commits in the updated README.

这篇关于更新时如何使主叉更改反映在主站中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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