使用Git处理离线和在线开发的最佳方式 [英] Best way to handle offline and online development with Git

查看:177
本文介绍了使用Git处理离线和在线开发的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许标题并没有完全表达我的问题,但一点解释就足够了。我有这种情况,我正在与另一位朋友开发一个网站,我们使用Git来管理代码的版本控制等。



问题是,在(我们两个人)都很好,我们同步,然后我们提交更改并提交。但是在工作中(我们在同一家公司工作),我们的防火墙阻止Git,有时我们可以在这里完成一些任务,但是无法检索或推送更新到Git,我们如何保持与Git同步的所有内容都变得疯狂?

经过几次尝试之后,只需将所有内容复制到随身碟,然后尝试在家中同步所有内容,然后拧紧所有内容,最后管理一些有点作用,这是通过使用xcopy仅新文件选项。但即便如此,有时也会让事情变得糟糕。



有人遇到过类似的情况吗?任何想法对我来说?感谢。

解决方案

使用笔式驱动器可以工作,但不是您使用笔式驱动器的方式。 b

您需要将笔驱动器视为遥控器。所以基本上你在笔驱动器上建立一个裸仓库,并从它推拉。 Git会管理所有的东西。



简而言之,就像这样:

 #使存储库在笔式驱动器中:
$ cd / path / to / pen / drive
$ mkdir repo; cd回购; git init --bare

并且在您的仓库中(包括家庭和工作):

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

然后,您可以按照您使用其他遥控器的方式,从 pendrive 开始推/拉。



然而,更合适的做法是让你的公司不要阻止ssh到GitHub(除非你不应该在工作中做这些事情,在这种情况下,他们在工作)。


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.

解决方案

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).

这篇关于使用Git处理离线和在线开发的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆