保持存储库同步,而无法推送和拉取提交
截至目前,我无法使用 git 服务器,因此我使用我最喜欢的 git 功能之一,即将计算机中的任何目录转换为 git 存储库(只是 git init 的东西)。
我曾经这样做是因为我是唯一一个编码的人,我可以跟踪我自己的东西。现在情况发生了一些变化,我正在与一个小团队合作。然而,其他一些事情没有改变,我仍然无法拥有 git 服务器,因此本地存储库仍然是唯一的选择。
最直接的过程是将代码分发给其他人,压缩我的存储库并将其发送出去。当他们完成后,他们将其发回给我,我替换原来的仓库。工作得很好,因为由于项目的组织方式,我们几乎从来没有两个人在同一个仓库中工作。
现在,我希望我可以做一些更一致的事情......比如,将他们发送给我的任何内容合并到我的本地存储库中。这个例子将允许我最终让两个人在同一个存储库(或者可能是它的子集)中工作。
我一直在阅读有关 git patch 脚本的内容。但说实话,我对这个解决方案感到不太舒服。首先,因为在我最初的实验中,它并没有立即起作用(是的,我知道这只是一个更好地理解它的问题,但仍然不如 git 的其余部分那么直观),其次是因为我的存储库还将包含我的二进制文件也需要控制..不确定补丁是否可以处理这个问题:/
你们会建议哪个程序来组织这个? 有没有一个命令可以让我按照我描述的方式合并到存储库?
谢谢!
f.
As of right now, I cant use an git server, so I use one of my favourite git features which is turning any directory in my computer into a git repo ( just the git init
thing).
I use to do this because I was the only one coding and I could keep track of my own stuff. Now things have changed a bit and I'm working with a small team. Some other things however did not change and I still cannot have a git server therefore the local repos are still the only option.
The most straight forward procedure has been to distribute the code to the other guys as zipping my repo and sending it over. When they are done, they send it back to me and I substitute the original repo. Works kind of fine since we almost never have two people working in the same repo due how the projects are organized.
Now, I wish I could do something more consistent.. like, merging whatever they send me into my local repo. This example would allow me to eventually have two people working in the same repo (or maybe subsets of it).
I have been reading about the git patch scripts. But to be honest I didn't feel very comfortable with the solution. First, because in my initial experiments it didnt work straight away (yeah, I know is just a matter of understanding it better, but still, not as intuitive as the rest of git) and second because my repos will also contain binary files which I need to be controlled as well.. not sure if the patches can handle that :/
Which procedure would you guys suggest to organize this?
is there a command which would allow me to merge to repos in the way I describe?
Thanks!
f.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
互相发送路径怎么样?
git 格式补丁
和git am
可能适合您的需求。我过去曾使用过它,它对于发送不频繁的更改来说效果很好。How about sending each other pathches?
git format-patch
andgit am
might suit your needs. I've used it in the past and it works well enough for sending infrequent changes.如果您有某种方法设置共享目录,即使它位于某人的计算机上,您也可以在那里执行 git init 并让每个人都将该存储库添加为远程目录。它不像 gitolite 或 SSH 那样干净,但应该可以正常工作。
If you have some way of setting up a shared directory, even if it is on someone's computer, you can do a
git init
there and have everyone add that repo as the remote. It isn't as clean as having gitolite or something SSH'd, but should work just fine.分布式版本控制的好处是您不需要只需要一台每个人都可以随时访问的服务器。您可以根据需要拥有任意数量的服务器。您可以在公司防火墙内设置服务器或共享目录,供有权访问的每个人使用,并让场外人员每个人设置自己的本地 ssh 或可以根据需要推送和拉取的内容。
如果您想在 zip 文件中继续您的邮件存储库,您所要做的就是不要替换您的主要本地存储库,而是将其解压缩到一个单独的文件夹中,然后从该文件夹中执行
git pull
操作您的主要存储库,以便将其合并到其中。在带宽方面,效率不如 git format-patch ,但在您的特定工作流程中更熟悉一些。The nice thing about distributed version control is you don't need just one server that everyone can reach all the time. You can have as many servers as you need. You can set up a server or shared directory inside the company firewall, for everyone who has access to use, and have your offsite people each set up their own local ssh or something you can push and pull from as necessary.
If you want to continue your mailing repos around in zip files, all you have to do is instead of replacing your main local repo, unzip it into a separate folder, then do a
git pull
from that folder into your main repo in order to merge it in. Not nearly as efficient bandwidth-wise asgit format-patch
, but a little more familiar in your particular workflow.