我的 git 存储库中有一个开发分支和一个功能分支。我添加了一个开发提交,现在我希望将该提交合并到我的功能分支中。如果我这样做
git checkout feature
git merge develop
我最终得到一个合并提交。由于我会经常将开发中的新提交合并到我的功能分支中,因此我想避免所有这些不必要的合并提交。我看到这个答案建议做一个git rebase develop
,但它最终将我的分支倒带得太远并且变基失败。
更新: 我最终做的是
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
更新:我刚刚注意到,当我合并然后 rebase 到功能分支时,develop 上的原始提交会获得不同的哈希值。我认为这不是我想要的,因为最终我会将功能重新合并到开发中,我猜这不会很好。