更新时如何使fork更改反映在master中?

时间:2016-10-08 03:14:42

标签: linux git github version-control commit

假设我从Github派出了一个repo,现在iam有两个项目源,一个是所有者存储库中的主要主分支,另一个是我叉子中的主分支。

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

假设在我的项目中有一个文件自述文件,其代码如下

完成的主题

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

所以我已经分配了我的回购,在完成每个主题后,我会标记一个X并将文件保存在我的本地仓库中。

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

到目前为止没有问题,但真正的问题是在完成两个主题期间,原始主人在自述文件中有更多主题,现在看起来就像这样。

完成的主题

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

所以现在我想更新链接,这些命令将无法使用,因为当我执行git fetch upstreamgit pull upstream master时,我之前的标记将会丢失。

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

完成的主题

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

请帮忙。

1 个答案:

答案 0 :(得分:2)

除了您应该在dedicated feature branch中进行任何演变之外,您不应该直接拉(将upstream/master合并到您的master

您应该pull --rebase(在更新的upstream/master之上重播您的本地提交),然后git push --force返回您的分支。

在更新后的README中重新提交提交后,您应该取回标记。

相关问题