I'm trying to reorder 2 commits, and I keep getting an error without any kind of explanation, so I have no idea what I'm doing wrong.
This is the repo:
$ git lol
* c0000ca (HEAD, master) added a title
* 132247f Turned colors to html
* 0ddaef3 Added last sentences
* 95f8007 initial commit
I want to swap 132247f and 0ddaef3.
$ git rebase -i 95f8007
This takes me into nano:
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
I swap both lines, save and exit. This is the error message I get:
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
As an error message, it's not very useful.... Anybody knows what's going on?
The only file in the repo seems to be in conflict:
$ 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
If I solve the conflict, add the file and run git rebase --continue, I get this other error:
$ 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
This is driving me crazy, any help is appreciated.
It looks like what's happening is that you successfully resolved the first merge conflict when applying "Turned colors to html" then hit another merge conflict when applying the next commit "Added last sentences".
Simply do a git status
to see what the merge conflicts are, resolve them then continue with git rebase --continue
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With