You really did not ask the actual question, but since this is a common precedent, I often use what I do here. You can try it yourself and see if the error persists.
My assumption about your use case: You have an existing directory containing files and directories, and now you want to convert it to a git repository that is cloned from somewhere else, without changing any data in your current directory.
There are two ways.
Clone repo - mv .git - git reset --hard
This method is what you did - clone an existing repo into an empty directory, and then move the .git directory to the target directory. To work without problems, you usually need to run
git reset
However, this will change the state of the files in your current directory. You can try this on a full copy of / rsync of your directory and examine what changes. At least after this you should no longer see the discrepancy between git log and status .
Initiate a new repo - point to the origin
The second less worries: cd to the destination and launches a new repo with
git init
Then you will say that the new repo, that it has an ancestor somewhere else:
git remote add origin original_git_repo_path
Then safe
git fetch origin master
to copy data without changing local files. Everything should be fine now.
I always recommend the second way to reduce the chance of errors.
cfi Feb 19 '13 at 15:27 2013-02-19 15:27
source share