gpt4 book ai didi

linux - 更新时如何使分支更改反射(reflect)在主服务器上?

转载 作者:太空宇宙 更新时间:2023-11-04 09:22:54 24 4
gpt4 key购买 nike

假设我从 Github fork 了一个仓库,现在我有 2 个项目源,一个是所有者仓库中的主主分支,另一个是我的 fork 中的主分支。

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

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

待完成的主题

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

所以我 fork 了我的存储库,在完成每个主题后我会标记一个 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]

请帮忙。

最佳答案

除此之外,您应该在 dedicated feature branch 中进行任何进化,你不应该直接 pull ( merge upstream/master 到你的 master)

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

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

关于linux - 更新时如何使分支更改反射(reflect)在主服务器上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39928309/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com