简体   繁体   English

如何`rebase`以避免在pull请求中重复提交

[英]How to `rebase` to avoid duplicated commits on pull request

  1. I did a PR to a repository. 我对存储库进行了PR。 Accepted and merged. 接受并合并。
  2. I git fetch upstream on my fork. 我在叉上git fetch upstream

    [Here starts the stuff I could not understand at all] [这里开始我根本听不懂的东西]

  3. I have a commit with a pre compiled message: Merge remote-tracking branch 'upstream/master' 我有一条带有预编译消息的commit合并远程跟踪分支“上游/主服务器”

  4. I pushed to my remote 我推到我的remote

  5. Continue working on another feature, pushed to remote and create another Pull Request where have the (3) commits of the old PR, the merge... commit and the (2 last) commits that are relative to this feature. 继续处理另一个功能,将其推送到remote并创建另一个“ 拉取请求” ,其中具有旧PR的(3)提交, merge ...提交和与此功能相关的(最后2个)提交。

Here is the PR, where only the last two commits are necessary. 是PR,仅需要最后两次提交。

期望的提交

As you could see, the owner propose to rebase but, sincerely, don't know how to solve it the right way. 如您所见,所有者建议重新定rebase但真诚的是,不知道如何解决正确的方法。

You could do : 你可以做:

git rebase -i origin/master

(you can change the origin/master to the branch you want to rebase on) (您可以将原点/母版更改为要作为基础的分支)

And then remove the lines of the unnecessary commits in the interactive mode. 然后在交互模式下删除不必要提交的行。 Then save and git push -f 然后保存并git push -f

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM