Bbar
Bbar

Reputation: 93

git -cant pull or commit

I have a problem committing, and pulling: In the commit IDE I see:

warning not all local changes may be shown due to an error: unable to read tree 

and only part of my files commits is there, also I cant see diff with the last versions.

when I try to pull/fetch:

error: refs/remotes/origin/project-1 does not point to a valid object!
error: refs/remotes/origin/project-2 does not point to a valid object!
....

and so on

in the end, the error is

fatal: pack has 268 unresolved deltas

Is there any way for me to fix it without cloning again?

Upvotes: 4

Views: 6400

Answers (1)

Bbar
Bbar

Reputation: 93

ok, I fixed it by using

mv -v .git .git_old &&            # remove old git
git init &&                       # initialise new repo
git remote add origin "${url}" && # link to old repo
git fetch &&                      # get old history
git reset origin/master --mixed   # force update to old history

it's from this stack question How to fix corrupted git repository?

Upvotes: 5

Related Questions