2

Apologies for the confusing question, I'm not sure how to describe it generally. I typed git rebase master to place my 4 commits in my current branch at the end of master's history.

But instead I am stuck in a state that says:

user@CPUNAME MINGW64 /d/Code/ClientRepo (branchName|REBASE 5/4)

5/4? How can I be 5 commits into the rebase if there are only 4 commits TO rebase?

git rebase --continue gives me the output: fatal: cannot resume: .git/rebase-apply/final-commit does not exist.

git rebase --abort seems to work, but after the command completes I still see branchName|REBASE 5/4 indicating the rebasing never aborted.

Totally stuck. Advice politely requested.

Edit: I have since unblocked myself by re-cloning the repo into a different directory. This meant that I lost my commits. Thankfully, there weren't too many changes and I re-created them.

However, I still have the old directory stuck in this state and am very curious what the fix might be as I've never seen this situation before. I'm leaving the question open and will try out suggestions - perhaps a potential answer could help someone else in the future.

Now, the main questions are, what could possibly lead to this state and how to unravel it?

Luke W
  • 63
  • 9
  • What was the state of your branch, and of master, before attempting the rebase? – J. Titus Jun 02 '17 at 17:11
  • My branch was created by branching off from master about ~20 commits back from where master is now. In the meantime I added 4 commits to my branch. – Luke W Jun 02 '17 at 17:14
  • What was the output of rebase prior to first showing this prompt? It must have said something when it stopped processing ... – Mark Adelsberger Jun 02 '17 at 18:01
  • I would copy-paste it here but I've tried many things since then and the output is no longer in my history. But it seemed like normal rebase output ("applying commit1, commit2, etc..."). I do have the git status output from immediately after this prompt first showed: `$ git status On branch branchName You are currently rebasing. (all conflicts fixed: run "git rebase --continue") nothing to commit, working tree clean` – Luke W Jun 02 '17 at 18:11
  • What version of git are you using? – Adrian Jun 02 '17 at 18:29
  • git version 2.11.1.windows.1 – Luke W Jun 02 '17 at 18:31
  • I'd try running `git fsck` on the broken repo just to see what it says, though I don't know how useful I'd expect it to be. I'd also try updating to latest git 2.13.0, just in case there's some fix that's applicable to your situation. Definitely sounds like a corrupted repo though, if you feel like being a good citizen, keep the broken repo and [file a bug report](https://git-scm.org/community). – Adrian Jun 02 '17 at 18:42
  • 2
    I believe you have tripped over a Windows-Git bug, where the last commit in a rebase sequence can't be properly `--continue`d. There was another question recently with the same bug, and I think VonC had a link to a bug report and/or fix. (The shell-prompt status comes about because you're still rebasing, and the number of steps left to go is "-1", so 4 minus -1 is 5.) – torek Jun 02 '17 at 18:50
  • Oh interesting, that would certainly explain it. I'd be interested in seeing that question/answer. – Luke W Jun 02 '17 at 18:57
  • Also @Adrian, running `git fsck` just gave me a long list of dangling commits/blobs. So you were right not much there. Seems that it really is just a git bug. – Luke W Jun 02 '17 at 19:09

1 Answers1

1

The first think to check is if the issue persists with:

You will have the new syntax git rebase --quit: that will help properly abort a rebase in progress.
I don't find yet a bug report I might have mentioned before, I will check the Git mailing list.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250