git - git rebase(?) to upstream without merging?
问题描述
(Note: I strongly suspect my issue here is that I don't know what term to search for, it's very possible that the terms I'm using and what I actually want are different things. Pleas don't assuming too much based on the terms I used.)
Edit: All of the following is with regards to remote. (For the sake of discussion; assume that at the start, no local clients exist anywhere and, once I'm done, any local client created will be deleted.)
I created a fork, created a PR, that was merged into upstream and I attempted a rebase. But now when I look at the branches I intend to continue using (e.g. master), they show as being a merge of upstream/master and the stuff I did in my fork, and that despite having no changes that don't come from upstream.
What I want is to have my fork's master, when viewed on GitHub, reflect reality and show as having only upstream/master in its history. That is:
If I didn't mind losing the rest of the history, I could accomplish this by deleting the entire repository and starting over, but that seems rather drastic for such a routine and necessary operation (and that won't work at all if I had other branches with ongoing work).
解决方案
我想要的是让我的 fork 的主人,当在 GitHub 上查看时,反映现实并显示其历史中只有上游/主人
如果我理解正确,那不是现实。你的分叉的历史从你创建分叉的那一点开始,而不是从远程主控的位置开始。您的 fork 将永远与远程并行运行,并根据需要进行前向/后向合并。
当我
git reset upstream/master ; git push origin master
收到“更新被拒绝,因为您当前分支的尖端位于其远程对应部分之后”时。
简短的回答是,你可以完成你想要的git push origin master -f
,有效地杀死你的分叉的历史,并扰乱可能在你的分叉上工作的其他人。
您所描述的听起来更像是您直接在遥控器上的贡献者所拥有的工作流程,为每个功能创建一个新分支。
Top 是典型的 fork 工作流程,bottom 是如果您作为远程贡献者开发独立功能分支时所遵循的工作流程。在合并到远程之后,红色是分叉主节点上的(完全有效的)提交。
推荐阅读
- mongodb - 如何在 go mongo-driver 库中使用 Find().Select().One()
- java - 非法 ArgumentException:Nexus 6 的 CameraProcessProvider.bindToLifecycle 中的“找不到可用的相机”
- java - java.lang.NoSuchMethodError: 没有虚拟方法 canCancel(Z)Lcom/amazonaws/mobile/auth/ui/AuthUIConfiguration$Builder
- javascript - jQuery 滚动速度
- c# - 玩家在拾取 Rigidbody2D 对象时表现得很奇怪
- sql - 在 SQL 中为变量的值赋值
- python - Pyspark 根据数据框 groupBy 制作多个文件
- python - 我只想删除一个类别中的语音通道
- sqlite - 没有这样的表:用户 [SQL: INSERT INTO users (username) VALUES (?)] sqlalchemy.exc.OperationalError: (sqlite3.OperationalError)
- android - 用于 Room 迁移类中的原始查询的 SQL 注入