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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With