Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git crash during rebase

Tags:

git

git-rebase

I have rather big amount of file in repository. Thus git sometimes crashes due to out of memory exception during rebasing changes.

E.g.

git checkout feature
git rebase master
(nasty out of memory exception)
.....

So once I got that exception, I tried again rebasing

git rebase master

And it told me that branch feature is up to date. That seems strange, as rebase finished with exception.

Are there any way to avoid oom exception? May be somehow tell git use smaller amount of memory. Could this exception be cause of repository corruption? If it causes corruption are there any way safely roll back changes made during rebase to state that was before git rebase master was called?

like image 698
michael nesterenko Avatar asked Oct 07 '11 21:10

michael nesterenko


3 Answers

Try:

git repack -a -f -d

http://git.661346.n2.nabble.com/running-out-of-memory-when-doing-a-clone-of-a-large-repository-td1491051.html

like image 122
Chris Avatar answered Nov 20 '22 22:11

Chris


You are probably running this on a VM or are storing some large files. Filter branch out large files if you can or bump up the memory :/

Not much else I can add unless I have more info..

like image 43
Adam Dymitruk Avatar answered Nov 20 '22 20:11

Adam Dymitruk


git rebase $BASE starts by doing git reset --hard $BASE

If it crashes due to out of memory after that, it means you're left with your branch pointer pointing to $BASE instead of the commit it pointed to before.

That's why you're being told that feature is up to date when you git rebase master again, because feature is already pointing to the same commit as master after the out of memory crash.

To reset your branch back to the original commit you were on before, run

git reset --hard HEAD@{1}`.

Or if you've done other work on the branch after the crash, run git reflog to find the original commit.

See also Undoing a git rebase


After you got your branch back to the original commit, you can try

git rebase -m master

which will try a different rebase strategy that probably uses less memory if you have large binary files.

like image 1
Christoffer Hammarström Avatar answered Nov 20 '22 21:11

Christoffer Hammarström