Patryk Patryk - 1 year ago 98
Git Question

Why after copying git repository to another dir I have modified files?

I have my personal small git repository on my laptop. I have just commited the changes and checked that I have nothing to commit - every staged and modified file has been commited.

After that I have copied all the files from this repo to another location and boom! I have uncommitted changes.

I believe I am missing some fundamental git rules. Can anyone suggest me on that ?

Answer Source

Your files on windows probably have carriage-return line-feed line endings and you likely have core.autocrlf true on your windows box. Don't copy it like that between different platforms. Instead create a new git repository on the linux box and pull from the the Windows box. You can either use git bundle or git daemon on the Windows machine to expose the repository. Or you could make a bare repo on the linux box and git push --mirror to it from the Windows machine then clone that where you want the final version to end up.

Or - quite likely you can already just do a git reset --hard HEAD and fix it on the linux box as-is. Possibly you should delete everything except the .git folder first to ensure a completely clean working tree.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download