我有一个本地分支集来跟踪远程 origin/master,它是由
创建的"git checkout -b mybranch origin/master"
现在之后,我在同一个本地分支上有两个单独的本地提交,并且 commit2 依赖于 commit1
现在我想将 commit1 中包含的更改推送到远程分支,正确的方法是什么?
我已经运行“git rebase -i”并将 commit1 更改为编辑,并且在 rebase 时 git 在 commit 1 停止,这就是我想要的。
但是如果我尝试执行类似“git push”的操作,我会收到错误消息
"fatal: 你目前不在一个分支上。 将历史推送到当前(分离的 HEAD) 现在陈述,使用
git push origin HEAD:<name-of-remote-branch>
",
现在假设我的 commit1 的散列是“abce”,将此更改推送到远程 origin/master 的正确方法是什么?
最佳答案
git status
告诉您如何取消工作副本中的 rebase 。 (可能是 git rebase --abort
)
然后您可以像这样推送特定的提交:
git push <remotename> <commit SHA>:<remotebranchname>
关于git - 如何在 git 的交互式 rebase 期间推送中间提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32832955/