Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: how to properly share local copy between multiple PCs

Tags:

git

I pull'ed some public repository, made few changes here and there. I committed them to my local copy. I regularly pull from remote to get changes from the public repo. Occasionally, I work on that local copy from different PC's and I need to move entire source code between PCs so that they share exactly the same changes. A few times I messed up copying and lost some of my local changes. So my question is: how can I set up some sort of local git server on one of the PCs so that I could still pull changes from that public repo and commit my local changes to my local git server so that I would be able to synchronize my work between multiple PCs without copying full source three?

I use Windows

like image 788
Pavel P Avatar asked Sep 15 '25 16:09

Pavel P


2 Answers

Remember that a git repository is ultimately just a set of files on disk.

You can put your main local git repository on a network share and then push / pull with repos on other computers on the same LAN.

This has worked well for me in the past (main repo on a server, other repos on laptops, desktop PCs etc.)

like image 94
mikera Avatar answered Sep 18 '25 04:09

mikera


You can also just host your fork of the project on any of the popular git hosters (GitHub, gitorious) and add them as a new remote. Then use this repository as your base.

You also should try to get your patches back into mainline. This safes you exactly that pain and helps others.

like image 28
pmr Avatar answered Sep 18 '25 05:09

pmr