z4y4ts
z4y4ts

Reputation: 2685

Inconsistent git origin repository state

I can't recall how, but I came up with this weird repository state,

At the moment when I pulling from origin I'm getting two states in cycle.

Synced, which I expect.

From example.com:repo
 + 8b6ca37...f2508d7 HEAD       -> origin/HEAD  (forced update)
Already up-to-date.

In sync

By the way, this forced update message looks weird also. If I do another pull, I get next state.

Unsynced, when master is 3 commits ahead of origin/master.

From example.com:repo
 + 8b6ca37...f2508d7 HEAD       -> origin/HEAD  (forced update)
Already up-to-date.

3 ahead

If I do another pull, I get first state.

In other words if I'm just pulling again and again, I see two states "synced" ⇄ "3 ahead" rather than one.

Any ideas how to fix this, please?

Can someone explain how this happened?

Upvotes: 1

Views: 334

Answers (1)

z4y4ts
z4y4ts

Reputation: 2685

A friend of mine helped me to get repo back to normal.

The solution is pretty simple, though mystique.

> git push origin :HEAD
To [email protected]:vmg.git
 - [deleted]         HEAD

> git pull
From example.com:repo
   739691a..8b6ca37  master     -> origin/master
Already up-to-date.

> git push origin HEAD
Everything up-to-date

I'll keep this question open in case if somebody wants to demystify this story and tell what has happened.

Upvotes: 1

Related Questions