Sam Kong
Sam Kong

Reputation: 5840

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

Upvotes: 3

Views: 1495

Answers (4)

Plopix
Plopix

Reputation: 185

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

Upvotes: 1

brycemcd
brycemcd

Reputation: 4543

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.

Upvotes: 1

VonC
VonC

Reputation: 1329092

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".

Upvotes: 2

jpalecek
jpalecek

Reputation: 47770

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).

Upvotes: 3

Related Questions