Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

recovering from git rebase

Tags:

git

rebase

I have a local branch work, where I created two new files a.py, b.py and committed them.

Then, instead of doing "git rebase origin/master", I accidently typed "git rebase origin master", and now the commit I did is gone and the files are gone. Does anyone know how I can recover my files?

like image 659
Schitti Avatar asked Mar 30 '10 10:03

Schitti


People also ask

How do I get out of rebase?

You can run git rebase --abort to completely undo the rebase. Git will return you to your branch's state as it was before git rebase was called. You can run git rebase --skip to completely skip the commit.

Can I undo git rebase?

Simply take the commits that you want to get rid of and mark them with "d" instead of "pick". Now the commits are deleted effectively undoing the rebase (if you remove only the commits you just got when rebasing).

How do I continue after git rebase?

When you're finished making all your changes, you can run git rebase --continue . As before, Git is showing the commit message for you to edit.

Which command is used to undo a git rebase?

To check out the original <branch> and remove the .git/rebase-apply working files, use the command git rebase --abort instead.


1 Answers

Undoing a git rebase

Git keeps the old refs (until you clean them up). You can switch back to the old refs from before the rebase just fine.

like image 160
Dietrich Epp Avatar answered Nov 15 '22 05:11

Dietrich Epp