Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Egit - Cannot checkout now - stuck in rebase state

Tags:

I asked a similar question a few days ago, but I did not get a helpful answer, so I want to make everything more precise.

I have a big project as a private repo on github. A friend of mine and me are currently working on it. I imported the whole repo into a local repository and into eclipse and everything went fine, until the merging conflicts came up. Everytime, I get a merging conflict (e.g. when I forget to pull before working on often used classes), the whole project in my eclipse workspaces switches into a state "Rebase w/merge":

Rebase w/merge state of the project

Now I get marks were the merge conflicts came up. So I opened the class to merge with the merge tool, edited everything I had to change and added the class to index again.

Next, I commited all merging changes and pushed everything to the upstream into master-branch (we only use master so far, because we both do not have much experience with git and vcs/svn).

But now, I neither can switch back to master branch, nor cancel rebase or do anything else.

I tried:

Rightclick on project folder -> Team -> Switch To -> master. Checkout fail

That is the error notification.

Next I was told to cancel the rebase in Git Repositories View:

Git Repo View

But neither my local repo nor the remote one has any option related to rebasing.

Next I tried "checkout" in the menu of the local branch. Same result. I also tried to push my local branch into the upstream:

enter image description here

This is my preset of the merge/rebase option, but both of those options bring up the same result:

enter image description here

I looked into my repo in github - all of my changes including the merge resolve are already pushed into the master branch and are ready to fetch. My teammate can pull them and can continue working on the project. But I cannot escape this Rebase w/merge state. Everytime this state came up, I had to delete all project resources, delete the local repository, re-import everything into eclipse and finally, I had to do every additional configuration over and over again.

So: How can I escape this rebase? And btw: What is the difference between rebase and merging?

like image 708
Cydhra Avatar asked Nov 30 '15 13:11

Cydhra


People also ask

How do I end an interactive rebase?

Git Rebasing Aborting an Interactive Rebase To do this, simply delete all commits and actions (i.e. all lines not starting with the # sign) and the rebase will be aborted!

How do I stop rebasing in Intellij?

Follow these steps: Open the repository folder in your terminal (linux, osx) or in the Git Bash (windows). Let's abort and start again, execute in the terminal: "git rebase --abort" . This command will revert your master to the HEAD state before you start the rebase.

How long does a rebase take?

Since a recent Gitlab upgrade we have the problem that the rebase operation in merge requests takes around ten minutes in some developers' repositories while it works perfectly fast in others.


2 Answers

In Git Staging view there is an option to abort rebase.

enter image description here

like image 51
Michał Grzejszczak Avatar answered Sep 21 '22 16:09

Michał Grzejszczak


Use the Merge upstream commit to local branch.

Rebase means changing the old master to new master code(i.e. changing the base of your branch) and merging means added your changes to master.

You can also try using git command line to resolve such conflict.

Using Git Rebase/Merge Process While working on your brach get all files added and pushed to server

git add . git commit -m "SSSS" git push -u origin <BranchName> git checkout master git pull 

[A] The master is older code means you can merge your code

git merge <your branch name> git push 

[B] Master has newer code and shows a list of files are pulled from server

$ git checkout your_branch  Note: make sure you are working in your branch $ git rebase master 

Now you will get a message about conflicts so start working on each file from bottom to resolve conflict now add that file

$ git add <filename which you just updated>  $ git rebase --continue 

Follow above two commands until all conflicts are resolved. Now master changed are merged into your branch and pushed to server << YOUR BRANCH Now you need to update master branch

$ git checkout master $ git merge <YOUR_BRANCH> $ git push 

Verify NOTE: When rebasing if your current changes are overwritten and you dont want to continue, run -

$git rebase --abort 

While doing merge/rebase if a message windows appear to write your commit statement, THERE IS NO ESCAPE... write something and then do the following-

$git reset --hard HEAD~1 

[This command will reset the current commit head to 1 level back to what happened in the last merge will revert]

like image 21
3 revs Avatar answered Sep 19 '22 16:09

3 revs