0

For my job I need to do a git rebase of my feature branch onto the development branch.

These are my commands thus far to prepare the rebase:

git checkout feature-branch
git rebase development
# resolve conflicts in Visual Studio
git rebase --continue

After this, I'm getting the following in the cmd:

git rebase stuck in shell after conflict

Now it's just as if I'm typing a novel in Notepad. Hitting enter, ctrl + C, ... doesn't do anything.

I've already read other questions like this one but this doesn't offer me a clue of how to complete the rebase / exit the shell.

So how do I finish this rebase operation? What buttons do I need to press?

Pieterjan
  • 2,738
  • 4
  • 28
  • 55
  • try `esc`, then `i`, type your commit message, then when done `esc`, `:wq` then enter – Z4-tier Feb 09 '22 at 10:42
  • (this looks like you're using the `vi` editor, if you're familiar with that) – Z4-tier Feb 09 '22 at 10:43
  • Thanks. It seems that this gets me back to the "merge conflict" state which I resolved earlier on. Visual Studio git indicates "Detached at xxxxxx" – Pieterjan Feb 09 '22 at 10:46
  • Ah after resolving once more, and running `git rebase --continue`, exiting with the keycodes you provided, I'm again on my branch. Then I had to pull the remote commits that weren't mine, and finally I could push my feature branch. I do have some notions of vim, but never used it myself, always bash. But I would never have come up with these keycodes. Can you post this as an answer? – Pieterjan Feb 09 '22 at 10:53
  • (Wondering if there's a `nano` equivalent too, I'm more used to that ) – Pieterjan Feb 28 '23 at 16:13
  • I think this will work: `git config --global core.editor "nano"` – Z4-tier Feb 28 '23 at 16:33

2 Answers2

3

It looks like you've been dropped into the vim editor, and currently in replace mode. You can get out of that by just hitting esc. Then you can type i to enter insert mode (which will probably behave more as you'd expect). Type your commit message, then hit esc again (back to command mode), then :wq (write-quit) and enter, and you're done.

Z4-tier
  • 7,287
  • 3
  • 26
  • 42
2

I don't have enough rep to post a comment, but as a side note it's possible to configure Git to use a different editor, for example git config --global core.editor "code --wait" would change the default to be VS Code

more information on this answer https://stackoverflow.com/a/36644561/18039381

Matt
  • 43
  • 1
  • 6