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 ?


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.

What I did, run

git diff | grep -B 2 @@ | grep +++

to get the actually changed files, then do revert on all others

Do the permissions between the folders change? Git will register the change of permissions.

Copying from Windows to Linux introduces a difference in file rights, these changes are also tracked by git.

I am facing the same problem. However I have copied files from the host linux system to a Virtual Box guest system. Some links get deleted, while some file permissions got changed, which I could fix by doing git config core.filemode false.

If you have nothing on stash to lose, do:

git checkout .

This will revert the working tree to your previous commit

If u have multiple branches and all changes pushed, then this solution might work

Just add and commit all the changes you see, to the current branch(say master). Then checkout another branch(say test) Delete the master branch locally(with -D option). Pull the master branch from git

Done.. !

Need Your Help

Internet Explorer 8 in Windows XP

javascript css windows internet-explorer-8

I have witnessed how Internet Explorer 8 (IE8) is in Windows XP and how it is in Windows Vista/7. Quite strangely, IE8 seems to be acting like IE7 for certain aspects of CSS and JavaScript (maybe for

Strange behaviour when filtering by date in Oracle

oracle date to-date to-char

I'm on an Oracle database, the following query: