9

2 つのコミットを並べ替えようとしていますが、何の説明もなくエラーが発生し続けるため、何が間違っているのかわかりません。

これはレポです:

$ git lol
* c0000ca (HEAD, master) added a title
* 132247f Turned colors to html
* 0ddaef3 Added last sentences
* 95f8007 initial commit

132247f と 0ddaef3 を入れ替えたい。

$ git rebase -i 95f8007

これは私をナノに連れて行きます:

pick 0ddaef3 Added last sentences
pick 132247f Turned colors to html
pick c0000ca added a title

# Rebase 95f8007..c0000ca onto 95f8007
#
# 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

両方の行を交換し、保存して終了します。これは私が得るエラーメッセージです:

error: could not apply 132247f... Turned colors to html


When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
Could not apply 132247f... Turned colors to html

エラーメッセージとしては、あまり役に立ちません....何が起こっているのか知っている人はいますか?

リポジトリ内の唯一のファイルが競合しているようです:

$ cat poem.md
<<<<<<< HEAD
Roses are red.
Violets are blue.

=======
Roses are #ff0000.
Violets are #0000ff.
All of my bases,
are belong to you.
>>>>>>> 132247f... Turned colors to html

競合を解決し、ファイルを追加して git rebase --continue を実行すると、次の別のエラーが発生します。

$ git rebase --continue
[detached HEAD 9aba127] Turned colors to html
 1 file changed, 4 insertions(+), 2 deletions(-)
error: could not apply 0ddaef3... Added last sentences

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
Could not apply 0ddaef3... Added last sentences

これは私を夢中にさせています。どんな助けも大歓迎です。

4

1 に答える 1

13

「Turned colors to html」を適用するときに最初のマージ競合を正常に解決し、次のコミット「最後の文を追加」を適用するときに別のマージ競合に遭遇したようです。

aを実行git statusしてマージの競合を確認し、解決してから に進みgit rebase --continueます。

于 2013-08-13T18:06:29.290 に答える