Search code examples
gitbitbucketgit-pullgit-extensionsgit-fetch

How can I transport a Git repo from one PC to another when the files are (probably) current?


I have a project on PC1 that I have been using GitExtensions and BitBucket to manage. Because of pre-git activity, the folder is pretty much replicated on another (remote) machine PC2, but there is no git repo there, and I want to export the existing git repo so that I get PC2 up-to-date with commits and other activity that are on PC1 and on BitBucket.

I want to do it as a fetch then merge operation, partly because I'm not totally sure the two PC's are aligned, and I want to see whats going on.

I tried to do it with a GitExtensions pull but after fetching when I tried a merge it was obviously going to complain that every existing file would be overwritten. Similarly if I try a commit, it decides it is going to update every file in the repo.

I'm just curious as to what the accepted "git" way of accomplishing this - how I can set PC2 up so that there isn't an initial mass overwriting of every source file?

Would transferring the entire .git\ folder tree from PC1 to PC2 work?


Solution

  • Yes, transferring the .git directory is actually somewhat reasonable. Once you copy the .git directory from PC1 to PC2, you can run git status or git diff on PC2 to see what is different on PC2.