0

所以我正在尝试使用http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html中的说明拆分提交

尝试搜索“SPLITTING COMMITS”

在那里它说“用“编辑”动作标记你想要拆分的提交。“

我该怎么做

当我执行 git rebase -i 它打开一个文件

# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# 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.
#
# Note that empty commits are commented out

...

我究竟如何从该对话框执行这些命令

编辑

所以我设法成功地变基并致力于我的本地回购......

问题是,当我尝试推送时,我收到错误消息:

 ! [rejected]        JJ-4322 -> JJ-4322 (non-fast-forward)
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'url.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

有任何想法吗?

4

1 回答 1

0

rebase -i COMMIT

将向您显示提交列表,您可以使用该列表中的任何内容更改默认选择命令

pick 6d6da13 0000, liquibase, fixing build snafu's

# Rebase c56baf2..6d6da13 onto c56baf2

变成

edit 6d6da13 0000, liquibase, fixing build snafu's

# Rebase c56baf2..6d6da13 onto c56baf2

编辑:

您的第二个问题是因为您正在重写历史并且您已经推送了现在与您当前状态冲突的旧版本。你需要做:

git push --force YOURBRANCH

这将覆盖遥控器上的内容。

于 2013-01-02T20:58:10.040 回答