修改合并的拉取请求
Amend merged pull request
我提出了一个合并到项目中的拉取请求。碰巧代码需要稍作修改。我怎么可能在无法访问主项目的情况下更改它?我运气不好,必须做一个新的 PR 吗?
谢谢。
是的,您应该提交另一个拉取请求。
使用 Git 的任何“重写”命令(如 commit --amend
或 rebase
时,避免更改共享提交很重要。
在其 Rebasing 章节中,Git Book says:
The Perils of Rebasing
Ahh, but the bliss of rebasing isn’t without its drawbacks, which can be summed up in a single line:
Do not rebase commits that exist outside your repository.
If you follow that guideline, you’ll be fine. If you don’t, people will hate you, and you’ll be scorned by friends and family.
When you rebase stuff, you’re abandoning existing commits and creating new ones that are similar but different. If you push commits somewhere and others pull them down and base work on them, and then you rewrite those commits with git rebase and push them up again, your collaborators will have to re-merge their work and things will get messy when you try to pull their work back into yours.
我提出了一个合并到项目中的拉取请求。碰巧代码需要稍作修改。我怎么可能在无法访问主项目的情况下更改它?我运气不好,必须做一个新的 PR 吗?
谢谢。
是的,您应该提交另一个拉取请求。
使用 Git 的任何“重写”命令(如 commit --amend
或 rebase
时,避免更改共享提交很重要。
在其 Rebasing 章节中,Git Book says:
The Perils of Rebasing
Ahh, but the bliss of rebasing isn’t without its drawbacks, which can be summed up in a single line:
Do not rebase commits that exist outside your repository.
If you follow that guideline, you’ll be fine. If you don’t, people will hate you, and you’ll be scorned by friends and family.
When you rebase stuff, you’re abandoning existing commits and creating new ones that are similar but different. If you push commits somewhere and others pull them down and base work on them, and then you rewrite those commits with git rebase and push them up again, your collaborators will have to re-merge their work and things will get messy when you try to pull their work back into yours.