Best way to handle offline and online development

2019-07-20 12:03发布

Maybe the title didn't exactly convey my problem, but a little explanation will be enough. I have this situation where I'm developing a website with another friend, and we're using Git to manage the versioning of the code, etc.

Problem is, at home (for both of us) is all good, we sync, then we submit changes and commit. But at work (and we work at the same company) our firewall blocks Git and sometimes we are able to get something done here, but without being able to retrieve or push updates to Git, how do we keep everything synched withtout Git going crazy?

After a few attempts at this, by simply copying everything to a pendrive and then try to sync it all at home, and screwing everything, finally managed something that "kinda works", which is by using xcopy with "newer files" only option. But even that sometimes messes things up.

Anyone ever come up a similar situation? Any ideas for me? Thanks.

2条回答
Viruses.
2楼-- · 2019-07-20 12:44

Why don't you work on your pen drive ? You can now find afordable yet durable pendrive, or even SSD with USB port on them.

Put your Git folder on it, backup it sometime on a classic hard drive. And you're done.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-07-20 12:51

Using a pen-drive could work, but not the way you use it.

What you need is to treat the pen-drive as a remote. So basically you make a bare repository on the pen-drive and push-pull from it. Git will then manage everything.

In short, something like this:

# make repository in pen-drive:
$ cd /path/to/pen/drive
$ mkdir repo; cd repo; git init --bare

And in your repositories (both at home and work):

$ git remote add pendrive /path/to/pen/drive/repo

You can then start pushing to/pulling from pendrive the same way you would do any other remote.

Still, more appropriate would be to ask your company to not block ssh to GitHub (Unless you shouldn't be doing these stuff at work, in which case, well don't do them at work).

查看更多
登录 后发表回答