Pushing an existing Git repository to Github only sends about half the commits?

前端 未结 7 2145
天涯浪人
天涯浪人 2020-12-31 14:17

I have a local Git repository I\'ve been developing under for a few days: it has eighteen commits so far. Tonight, I created a private Github repository I was hoping to push

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 14:28

    So, it turns out that both: the commit hash in .git/refs/heads/master was in correct and the information in .git/logs/refs/heads/master was incomplete; in that I mean it only went up to and included the commit hash specified in .git/refs/heads/master.

    Once I fixed these files (by hand), and pushed back to Github, everything was gravy again. I still have no idea what happened to get things in this state, but I'm glad I've at least figured out the fix.

    In case anyone is wondering: to fix .git/refs/heads/master, I just replaced the content of that file with the latest commit hash (HEAD), and to fix .git/logs/refs/heads/master, I simply copied the contents of .git/logs/HEAD into .git/logs/refs/heads/master. Easy peasy... NOT.

提交回复
热议问题