Pull请求中包含我在其他分支上的提交?

问题描述 投票:0回答:1

我知道这个不断变化的分支基础技巧,并且在这个问题上没有用:GitHub pull request showing commits that are already in target branch

就我而言,我正在从我从事的其他分支获取我的提交,然后再切换到分支。我该如何解决?

git github git-commit git-pull
1个回答
0
投票
一个相对简单的解决方案是从master(或您要合并到的分支)中创建一个完整的新分支,然后仅从旧分支中逐一挑选您要在PR中显示的提交。然后您需要使用原始分支名称强制推送到github。

git checkout -b new_attempt origin/master git cherry-pick <commit1> git cherry-pick <commit2> ... git push --force origin new_attempt:mybranch

© www.soinside.com 2019 - 2024. All rights reserved.