If I make a copy of a tracked folder using rsync -a
or cp -R
, can I then use the copy as if it were a git clone, or will that cause all sorts of weird
When you clone someone else’s repository, it basically just copies the contents of this directory to your computer.
From the real good Git Internals (Scott Chacon) from Peepcode Press. (Page 44) So just the reference to the origin is missing as far as I'm concerned/I see.
With best regards.
It's exactly the same, well, almost, if you want the same in 'project3' just do:
git remote add origin /home/itsadok/project
git branch -f master origin/master
It is safe.
The difference in using "git clone" is that it automatically sets up the origin repository, so that you can easily use "git pull" and "git push" to synchronize the two repositories. Also "git clone" does not copy the logs, index and other configuration that is local to a repository. It only copies the version history of the repository (and even that can be stored at byte-level differently, because Git every now and then compresses its database when using "git gc").
Those differences that you see in your example are because rsnc copied also the working directory index, logs and because the rsync-copy did not set up the remote origin. There are quite many configuration and log files that are local to a repository. But there is no danger in copying them directly, for example when restoring backups or moving the repository to another directory/harddrive/machine.