开发者

git status shows modified after files copied

When I copy files from my Linux machine to my external HDD (FAT format), 'git status' shows that files are modified. I guess that occurs because of the file system difference.

I formatted the external HDD with FAT to share it with my Mac, Windows, and Linux.

How can I solve 开发者_开发百科this problem?

Thanks.

Sam


This could be caused by mismatched permission bits. From git-config manpage:

core.fileMode

If false, the executable bit differences between the index and the working copy are ignored; useful on broken filesystems like FAT. See git-update-index(1).


Don't forget to set your core.autocrlf to false.
The eol (end of line) style can vary between OS/supports and introduce those "changes".


When you're copying files, if you're physically moving the bits from one disk to another (like with cp or drag and dropping), then you might consider creating a bare repo on your external drive to push/pull from on your other systems.

It doesn't address the EOL changes that need to be made ( mentioned in VonC's response for example), but it does save a little time copying files back and forth between drives.


Another solution could be, if you are sure that there is no changes between the 2 folders, to checkout and pull

git checkout -- .
git pull
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜