Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recover lost changes during unfinished rebasing

I lost a lot of my work because I had unfinished rebase. I find out it when I was trying commit my 2 day work. I couldn't commit works until rebase is not resolved, so I abort it, because skip or continue didn't work. But with abort all my changes are gone ... can you tell me if it possible to recover these data please? Thank you in advice.

like image 639
Denis Stephanov Avatar asked May 22 '18 18:05

Denis Stephanov


People also ask

How do I recover uncommitted changes in IntelliJ?

Revert uncommitted changesIn the Commit tool window Alt+0 , select one or more files that you want to revert, and select Rollback from the context menu, or press Ctrl+Alt+Z .

How do I undo a rebase in Visual Studio?

So for example, if you rebase featureA branch onto your master branch, but you don't like the result of the rebase, then you can simply do git reset --hard featureA@{1} to reset the branch back to exactly where it was before you did the rebase.

How do I stop rebasing in IntelliJ?

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.


2 Answers

If you are using Intellij Idea you can use Idea's Local History.

Right click on package of source code which you want to restore (e.g, main) and select Local History > Show History and you will see your code history (also uncommited changes). Now you can find change when you lost your code and revert it.

enter image description here

like image 200
Martin Ondo-Eštok Avatar answered Nov 11 '22 19:11

Martin Ondo-Eštok


IntelliJ itself is extremely aggressive about indexing and versioning your local changes to files (for me, it goes back months). Even if git has no way of helping, you might be able to recover your changes from IntelliJ.

Try this:

  1. In the Project Explorer, right-click on the root folder for your project and click Local History > Show History
  2. From the list of changes on the left, find the revision that you want to restore. IntelliJ labels revisions with additional helpful information like tests passing, commits, etc.
  3. Right-click on the revision and click Revert to restore the directory to that revision. Alternatively, use Create Patch to create a patch file.
like image 35
Mark Peters Avatar answered Nov 11 '22 19:11

Mark Peters