Issue
Hello I have a problem since this afternoon. I am not using git very deeply so I just use git add
git commit
and git push
basically but when I wanted to commit my changes I made a git status
to check and every file was untracked.
The problem is that even if I use git add .
everything will be tracked again but then if I wait a few seconds everything returns to untracked.
In vsc my branch is not called main
anymore but main +
see the screenshot under :
I don't know how this happened I did not try tricky manipulations ;) if you have any idea to fix it or if you need more information tell me
Solution
Your problem is that you're using a cloud syncing service to store your code, in this case iCloud. As you've noticed, that can cause odd behaviour where data is changed in ways you didn't expect, and it can also cause corruption.
The reason that occurs is that cloud syncing services sync file by file and can reorder or roll back individual file operations. Git writes files in a very particular order and requires that to maintain data integrity, but cloud syncing services don't know that and don't follow the same order of operations. In this case, iCloud is probably rolling back your index without your consent.
You should move your repository outside of any directory synced by a cloud syncing service, and this problem will go away. You should also run git fsck
to verify that the repository is intact. Dangling objects are fine, but other problems indicate corruption that you'll need to fix by restoring from another copy.
Answered By - bk2204 Answer Checked By - Mary Flores (WPSolving Volunteer)