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 problems? This is all running on my computer, so no one else is accessing the repository.
Obviously, the git-cloned dir know where it was copied from, so I can do git pull
without specifying a source, but assuming I am willing to live without that, is there something I need to worry about?
As an experiment, I created a little project, clone
d it and rsync
ed it, and diff
ed the resulting folders. Here are the results:
itsadok@quad ~
$ git clone project/.git project2
Initialized empty Git repository in /home/itsadok/project2/.git/
itsadok@quad ~
$ rsync -a project/ project3/
itsadok@quad ~
$ diff -r project2 project3
Only in project3/.git: COMMIT_EDITMSG
diff -r project2/.git/config project3/.git/config
7,12d6
< [remote "origin"]
< url = /home/itsadok/project/.git
< fetch = +refs/heads/*:refs/remotes/origin/*
< [branch "master"]
< remote = origin
< merge = refs/heads/master
Files project2/.git/index and project3/.git/index differ
diff -r project2/.git/logs/HEAD project3/.git/logs/HEAD
1c1
< 0000000000000000000000000000000000000000 bf6be23d68d0ede45aca7479795693bfba76e73a itsadok <itsadok@quad.(none)> 1242131284 +0300 clone: from /home/itsadok/project/.git
---
> 0000000000000000000000000000000000000000 bf6be23d68d0ede45aca7479795693bfba76e73a itsadok <itsadok@quad.(none)> 1242131066 +0300 commit (initial): first commit
diff -r project2/.git/logs/refs/heads/master project3/.git/logs/refs/heads/master
1c1
< 0000000000000000000000000000000000000000 bf6be23d68d0ede45aca7479795693bfba76e73a itsadok <itsadok@quad.(none)> 1242131284 +0300 clone: from /home/itsadok/project/.git
---
> 0000000000000000000000000000000000000000 bf6be23d68d0ede45aca7479795693bfba76e73a itsadok <itsadok@quad.(none)> 1242131066 +0300 commit (initial): first commit
Only in project2/.git/logs/refs: remotes
Only in project2/.git: packed-refs
Only in project2/.git/refs: remotes
There's quite a bit of a difference, but most of it seems to be about the reference to the origin. Am I right?