Duplicate files in the git repo on macOS

실리콘·2023년 2월 16일
0

My Problem

when using git on macOS, duplicate files appeared after switching branches.

Solution

move your git repo to somewhere not tracked by iCloud

Mechanism

iCloud watches registered directories. When git sweeps files to change branches etc, iCloud will also detect a file change, and try to its own synching routine. Underlying process depends on its synching routine/algorithm.

Explanation

Don't use together a file synching service (iCloud, Dropbox, Google Drive eetc.) and a version control (git, svc etc.). Will run into duplicates. if you use repository hosting service like github, gitlab, Bitbucket), you alreaday get avilability and security you are getting from iCloud.

reference

https://stackoverflow.com/questions/59308049/icloud-drive-desktop-sync-vs-git-deleted-files-reappear-and-duplicates-with-n
https://stackoverflow.com/questions/62385234/git-keeps-duplicating-files-and-appending-2-at-end-of-filename

profile
software engineer

1개의 댓글

comment-user-thumbnail
2024년 1월 19일

Apple devices are very easy to use, as it turns out. To be honest, I’m one of those people who used Android for a long time and was skeptical about more expensive Apple devices. However, now I have a Mac, and it’s really convenient. If any difficulties suddenly arise, I usually look for information on SetApp, for example, https://setapp.com/how-to/select-multiple-files-on-mac . Such articles will be especially useful for beginners like me who have just switched to using MacOS.

답글 달기