DropBox and other similar cloud disk services such as SpiderOak will mess up your git index files because it might try to synchronize in the middle of these files modifications, and so it will upload a partial state and will then download it back, completely corrupting your git state.
Luckily, this is easily fixable by coming back to the last state using git reset --keep
.
Then, to avoid this issue, you can:
- Bundle your git index in one file using
git bundle create my_repo.git --all
.
- Set a delay for the file monitoring, eg 5 minutes, instead of instantaneous. This will reduce the chances DropBox synchronizes a partial state in the middle of a change. It also helps greatly when modifying files on the cloud disk on-the-fly (such as with instantaneous saving note-taking apps).