Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git how to exit rebase mode [duplicate]

Tags:

git

I did a Git rebase, fixed the conflict and force pushed already, why it is still rebase mode, "dev|REBASE 2/3" ? how to exit it ? I don't want to throw away the rebase.

aaa@lenovo-pc MINGW64 ~/Documents/NetBeansProjects/GitTest1 (dev|REBASE 2/3)
$ git status
rebase in progress; onto f67f4c5
You are currently rebasing branch 'dev' on 'f67f4c5'.
  (all conflicts fixed: run "git rebase --continue")

nothing to commit, working tree clean

aaa@lenovo-pc MINGW64 ~/Documents/NetBeansProjects/GitTest1 (dev|REBASE 2/3)
$ git push --force origin dev
[email protected]'s password:
Everything up-to-date

aaa@lenovo-pc MINGW64 ~/Documents/NetBeansProjects/GitTest1 (dev|REBASE 2/3)

Thanks

like image 650
user1615666 Avatar asked Dec 09 '16 02:12

user1615666


2 Answers

git rebase --abort

this should do the trick for you.

UPD:

git rebase is somewhat "atomic" operation. You cannot finish it in the middle. Think of it as of the transaction. It either finishes or not. If you think that you're finished, but your working copy is still in "rebase" mode than means you've done something wrong, i.e.:

  • Manually added the commit with git commit
  • Didn't resolve the conflict if that was the case. Usually rebase is an automatic operation that you just run and watch, it stops only when the conflict is not resolved.

How to resolve a conflict? Well, that is a good separate question.

like image 157
Xobb Avatar answered Sep 22 '22 01:09

Xobb


I have generally found that simply following the instructions which prompts to you during the rebase process usually doesn't go wrong. Based on the snippet you showed us, which says:

(all conflicts fixed: run "git rebase --continue")

your next move probably should have been to run git rebase --continue to finish the rebase, or at least move to the next applied commit.

What to do now:

Instead of completing/continuing with the rebase, you force pushed the dev branch to the remote. Since you would likely have to force push this anyway after the rebase, I don't see any long term harm being done. So you should just complete the rebase by doing

git rebase --continue

and then force push again once the rebase is actually completed.

By the way, if you decide that you really want to throw away the rebase, you can do so via

git rebase --abort
like image 25
Tim Biegeleisen Avatar answered Sep 24 '22 01:09

Tim Biegeleisen