如何配置Git以便与Dropbox一起使用? [英] How to configure Git for using it with Dropbox?

查看:70
本文介绍了如何配置Git以便与Dropbox一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用git半年左右了,我不知道我是否在完全使用git.

I have been using git for half a year or so and I don't know whether I am using git fully.

首先,我一直在试验dropbox,我觉得如果我可以将其合并到我的工作流程中,那将会非常好,因为dropbox非常方便.

First of all, I have been experimenting with dropbox and I feel that if I can incorporate it into my work flow, it would be really great since dropbox is pretty convenient.

  1. 我有一台台式机和一台笔记本电脑.两个都有保管箱.
  2. 我通过以下方式初始化了我的保管箱存储库做一个 git init --bare .然后在我的桌面的提交后脚本中,我有一个 git push --mirror投寄箱.
  1. I have a desktop, and a laptop. Both have dropbox.
  2. I initialized my dropbox repos by doing a git init --bare. And then in my Desktop's post-commit script, I have a git push --mirror dropbox.

这样,我的桌面和保管箱将始终被完全镜像,这是一件好事.

This way my desktop and dropbox will always be completely mirrored, which is a good thing.

我真正的问题是:我应该如何设置笔记本电脑?我一直在听一些建议:

My real question is: How should I set up my laptop? I have been hearing a few suggestions:

  1. 从我的桌面上拉出,以便笔记本电脑的起源是台式机.
  2. 直接从保管箱中拉出,这样我的笔记本电脑的来源是保管箱.

我一直在做2号,但我不知道我在做正确的事情.我的工作流程包括:

I have been doing number 2, and I don't know if I am doing the right thing. My work flow includes:

  1. 每次我在笔记本电脑上时,我都会进行git pull(因为笔记本电脑的来源是保管箱,并且保管箱本身会进行更新)
  2. 然后,当我从Dropbox签出分支到本地分支时.
  3. 完成工作后,我会做出承诺.
  4. 这是我感到困惑的地方:我也应该将--mirror推送到我的保管箱存储库(笔记本电脑的原始存储库)吗?我在这方面遇到了一些困难:有时Dropbox的同步效果不太好,等等

当前,在笔记本电脑上执行 git push --mirror origin 后,在我的桌面上执行 git branch -r 不显示我最近的笔记本电脑提交.有人可以告诉我为什么吗?

Currently, doing a git branch -r on my desktop after doing git push --mirror origin on my laptop doesn't show my recently laptop commits. Can someone tell me why?

我提到直接从桌面进行拉动,因为这样我就可以始终初始化拉动,并且我100%确信同步已完成.使用Dropbox,我永远无法100%确定更新是否已推送到Dropbox服务器

推荐答案

如果要添加中间仓库,可以使用Dropbox:

If you want to add an intermediate repo container, Dropbox is fine provided:

  1. 您使用 git bundle 格式 :它仅生成一个一个文件的裸仓库(这意味着Dropbox更有可能正确地将其同步到您的任何计算机:这只是复制一个文件,而不是不确定要从中获得一切的整个结构"文件.

  1. You use the git bundle format: it generates a bare repo with only one file (meaning Dropbox is more likely to correctly sync it to any of your computers: it is just about copying one file, not "the whole structure" from which you are not sure you will get everything back).

您正在为每个保存使用增量捆绑包(同样,每个保存使用一个文件,易于从另一侧提取以取回已完成的操作).
在来源(笔记本电脑或台式机)上并以日期命名您的增量.
基本上,您将从尚未拉出的任何xxx.bundle中拉出.

You are using incremental bundle for each of your saves (again, one file per save, easy to pull from on the other side to get back what has been done).
Name your increment after the source (laptop or desktop) and with the date.
Basically, you will pull from any xxx.bundle you haven't pulled yet.

您定期清理所有中间增量软件包,并用最新来源的完整软件包替换它

You regularly clean all the intermediate incremental bundles, replacing it with a full bundle from whatever source is the most up-to-date

该模型允许:

  • 简单的同步过程(一个或很少的文件)
  • 快速保存过程(带有增量捆绑包)
  • 扩展:如果有多个角色,即,如果多个人正在更新同一分支,则可以通过使用不同的远程名称引用他们的捆绑包来分离他们的贡献(从每个捆绑包都是一个裸仓库,您可以从中取出它.)
  • simple sync process (one or very few files)
  • quick saving process (with incremental bundles)
  • scaling: if there is more than one actor, i.e. if several people are updating the same branch, you can isolate their contributions when pulling from them by referencing their bundles using a different remote name (since each bundle is a bare repo from which you can pull).

这篇关于如何配置Git以便与Dropbox一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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