git - Rebase-merge another branch into the current one
问题描述
Is there an easy way to rebase another branch onto the current one without moving the other branch or switching to it? This is the feature that github calls "rebase and merge" in pull requests.
So I want to have the same result as if running these commands (starting on master
):
git checkout -b tmp feature
git rebase master
git checkout master
git merge --ff-only tmp
git branch -d tmp
But it is important to me that I don't actually switch to the other branch. feature
might be many commits behind master and I am working on a huge c++ codebase. I don't want a full rebuild to merge a branch that only touched two files.
I tried git cherry-pick HEAD^ feature
, but that complains if commits from feature
where cherry-picked to master before. Also, I would prefer to have the option of an interactive rebase, so I can change a commit message or leave out a commit in this step.
I also found git merge feature --strategy=ours && git rebase HEAD^
. But creating that useless merge seems strange and if I abort the rebase, I now have to remember to delete the merge from my master.
In case I am missing something very basic and should approach this completely differently: My context is that I'm using git-svn to work against a svn repository. I have a worktree with a current build of trunk. I want to get my feature-branch commits, make sure the new state builds, maybe polish some commits and push the changes to the svn repo.
解决方案
推荐阅读
- ruby - Jekyll 服务没有打开端口
- python - 为 DC GAN 创建图像数据集
- java - 如何从 POM.xml 中读取 application.properties
- android - 无法以编程方式删除android上的短信
- python - 获取邀请不和谐机器人 discord.py 的人
- javascript - 如何在引导程序 4 自定义选择中完全隐藏双箭头
- c - os161 中的 userptr_t 类型有什么用?
- javascript - 如何在父级底部使用 jQuery 或 css 修复元素
- javascript - 选中框时显示按钮
- tensorflow - Keras 模型的图形表示