git:如何在本地分支 A 之上的远程分支 B 中找到交互式 rebase 提交?

时间:2021-07-27 17:02:12

标签: git github rebase git-rebase

我基本上想在本地分支a之上以交互方式重新调整远程分支b中的2个更改(shas 1a28dba和be7c442),以便我可以将它们推送到远程分支a。

我尝试了这个(以及其他一些变体);但是,我正在寻找的更改在 rebas 之后没有应用;我相信我在执行此操作时检查了 local-branch-b

git rebase -i --onto local-branch-a remote-branch-b

交互式会话中的结果很奇怪;不确定 noop 是什么;但是,shas 是正确的(即将 10b67a636..10b67a636 重新设置为 8d00e80c2(1 个命令)):

noop
# Rebase 10b67a636..10b67a636 onto 8d00e80c2 (1 command)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
#                    commit's log message, unless -C is used, in which case
#                    keep only this commit's message; -c is same as -C but
#                    opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# .       create a merge commit using the original merge commit's
# .       message (or the oneline, if no original merge commit was
# .       specified); use -c <commit> to reword the commit message
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

你应该像这样运行它:

git rebase --onto remote-branch-a remote-branch-b~2 remote-branch-b

如果您确实需要与它进行交互,请使用 -i

更新:也许你打算运行的是:

git rebase --onto remote-branch-a local-branch-a remote-branch-b

如果 local-branch-a 是 remote-branch-b 后面的 2 个修订版,那应该可行

相关问题