I just reverted my Mac back to its state 10 days ago using Time Machine. I then updated my website's repository folder back to 1 day ago to keep coding.

When I run git status or gitk, it shows the 10-day old view, not the current view, so it's missing some recent commits. Where is the folder/file I have to update to get the current data?

In case this clarification is needed, my origin on Github has commits from 6/10, 6/7, 6/1, and 5/30. My faulty git status only shows commits 6/1 and 5/30, and the other files are just floating around in the staging area as if never committed.

有帮助吗?

解决方案 2

Problem's cause

My local folder contains a hidden .git folder, which is the local repository (thanks @JonathanLeffer). Time Machine did not restore the .git folder when I selected all files in my repository for a manual restore.

Solution

I manually restored .git to its state as of 1 day ago, making sure to choose 'replace' for all files to make sure the old files are overwritten with the newer ones. After running gitk, all commits are visible for 6/10, 6/7, 6/1, and 5/30.

其他提示

I'm not familiar with time machine, but this sounds a bit like what can happen when you share a repo across multiple computers with dropbox or spideroak or the like. The system basically tries to keep up with your work in the repo, but it's optimised for background work and for not disturbing your active use of the computer, so if it's not 100% tracked all file changes in your .git folder from one computer to the other, you can get a repo that is broken. I'm wondering if this kind of action in your backup system has caused the same issue?

Anyway - try making a new empty repo folder and pulling a whole fresh new copy of the project from github.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top