小编git*_*itq的帖子

如何将develop分支中的git提交合并到一个功能分支

我的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到功能分支时,开发时的原始提交会获得不同的哈希.我不认为这就是我想要的,因为最终我会将功能合并到开发中,我猜这不会很好.

git git-merge git-rebase feature-branch

31
推荐指数
2
解决办法
4万
查看次数

如何将git提交从master转移到另一个现有分支

我检查了一些master应该已经签入的提交develop.我用什么git命令从master分支中删除那些提交并包含在develop分支中?

git branch

27
推荐指数
3
解决办法
3万
查看次数

标签 统计

git ×2

branch ×1

feature-branch ×1

git-merge ×1

git-rebase ×1