我的git仓库中有一个开发分支和一个功能分支.我添加了一个开发提交,现在我想将该提交合并到我的功能分支.如果我这样做
git checkout feature
git merge develop
Run Code Online (Sandbox Code Playgroud)
我最终得到了合并提交.由于我将频繁地将关于开发的新提交合并到我的功能分支,所以我想避免所有这些不必要的合并提交.我看到这个答案建议做一个git rebase develop
但是它最终会重新绕过我的分支方式而且rebase失败了.
更新: 我最终做的是
git checkout feature
git merge develop # this creates a merge commit that I don't want
git rebase # this gets rid of the merge commit but keeps the commits from develop that I do want
git push
Run Code Online (Sandbox Code Playgroud)
更新:我刚刚注意到,当我合并然后rebase到功能分支时,开发时的原始提交会获得不同的哈希.我不认为这就是我想要的,因为最终我会将功能合并到开发中,我猜这不会很好.
我检查了一些master
应该已经签入的提交develop
.我用什么git命令从master分支中删除那些提交并包含在develop分支中?