Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving repo to another computer

I've moved a repo from computer A to computer B. I've verified that the commits waiting to be pushed are still there on B, but the whole repo (every single file) is unstaged. I don't want to add them and push them as a commit because I have not changed every single file from when I copied the repo till I pasted it. When I moved the repo it only had the commits pending to be pushed, not changes.

I have seen this question, but it didn't help with this.

like image 729
Odaym Avatar asked Sep 24 '14 16:09

Odaym


People also ask

How do I copy a repository to another?

You first have to get the original Git repository on your machine. Then, go into the repository. Finally, use the --mirror flag to copy everything in your local Git repository into the new repo.

Can I copy Git folder to another computer?

Yes you can, but there's no need to copy the full working tree. You can copy just the . git folder without the working tree (i.e. as a "bare" repo) and then checkout the latest working tree on the other machine.


1 Answers

On the copied repo folder of computer B, do

git reset --hard HEAD

if you just want to copy the committed code from A to B but leave behind the local modification on B, after copy the repo folder from A to B.

like image 143
palazzo train Avatar answered Sep 29 '22 13:09

palazzo train