开发者

git crash during rebase

开发者 https://www.devze.com 2023-04-12 01:59 出处:网络
I have rather big amount of file in repository. Thus git sometimes crashes due to out of memory exception during rebasing changes.

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 bac开发者_运维知识库k changes made during rebase to state that was before git rebase master was called?


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


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..


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号