使用Dropbox同步文件并在版本控制中备份它们 [英] Using Dropbox to synchronize files and having them backed up in version control

查看:150
本文介绍了使用Dropbox同步文件并在版本控制中备份它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Dropbox作为随机文本笔记(org-mode)和我自举的点文件,即


  1. 部分我的bash初始化
  2. emacs配置

  3. vim配置

组织模式文档建议在编辑折叠部分时出现错误。说得通。如果我想退出配置更改,我也想备份。



有很多关于为什么使用git可以在dropbox中打破的帖子。



我看到几个选项:


  1. 不使用dropbox并使用bitbucket托管git上的文件。缺点是,当我切换机器时,我必须记住要进行任何更改,这是不方便的。


  2. 我可以通过chron作业使用git我的一台机器来备份dropbox文件夹中的文件,并确保git目录不被dropbox同步。缺点是这是有点不对称的,因为一台机器在保管箱文件上有git。然而,历史只是为了备份的目的而不是协作的目的。

  3. 不用担心dropbox问题,因为我经常提交更改并且几乎没有其他命令使用git存储库。

  4. 也许是#1和#2的组合。偶尔会将我的更改推送到远程,使.git目录不同步。

  5. >

    您可以使用dropbox,而不是用于完整的Git仓库(因为需要同步的文件数量很多,并且即使其中一个文件无法正确同步也会导致损坏的仓库的风险),如现在Git ref master空了,怎么恢复? )。

    我更喜欢将dropbox与git repo bundle 结合使用(即一个文件):

    请参阅使用Dropbox的Git 备份本地Git存储库

    博客文章 可以看到一个< a href =https://gist.github.com/1408924 =nofollow noreferrer>此类任务的脚本在这里(例如 shtirlic(Serg Podtynnyi)):

     #!/ usr / bin / env ruby​​ 
    if __FILE__ == $ 0
    bundle_name = ARGV [0] if(ARGV [0])
    bundle_name =`pwd`.split('/')。last.chomp if bundle_name.nil?
    bundle_name + =.git.bundle
    puts备份到包#{bundle_name}
    `git包创建〜/ Dropbox / backup / git-repos /#{bundle_name} - all`
    end


    I'm using dropbox for random text notes (org-mode) and dot files that I bootstrap, namely

    1. part of my bash initialization
    2. emacs configuration
    3. vim configuration

    Org-mode documentation suggests some backup in case of a mistake in editing folded sections. Makes sense. I also want backups in case I want to back out configuration change.

    There are tons of postings on why using git can break in dropbox.

    I see a few options:

    1. Not use dropbox and use bitbucket to host the files on git. The disadvantage is that when I switch machines, I have to remember to pull any changes, which is not convenient.

    2. I can use git via a chron job on one of my machines to backup the files in the dropbox folder and make sure that the git directory is not sync'd by dropbox. The disadvantage would be that this is a little asymetrical in that one machine has git on the dropbox files . However, the history is just for backup purposes rather than collaboration purposes.

    3. Not worry about the dropbox issues, as I infrequently commit changes and hardly do any other commands with the git repositories.

    4. Maybe a combination of #1 and #2. Occasionally push my changes to remote, having the .git directory not sync'd.

    解决方案

    You can use dropbox, just not for a full bare Git repo (because of the high number of files to synchronize and the risk for a corrupted repo if even one of those file doesn't get sync properly, as shown in "Git ref master now empty, how to recover?").

    I prefer to use dropbox in conjunction with a git repo bundle (ie one file):
    See "Git with Dropbox" and "Backup a Local Git Repository".
    See a detailed analysis in this blog post.

    You can see an example of a script for that kind of task here (example by shtirlic (Serg Podtynnyi)):

    #!/usr/bin/env ruby
    if __FILE__ == $0
            bundle_name = ARGV[0] if (ARGV[0])
            bundle_name = `pwd`.split('/').last.chomp if bundle_name.nil?
            bundle_name += ".git.bundle"
            puts "Backing up to bundle #{bundle_name}"
            `git bundle create ~/Dropbox/backup/git-repos/#{bundle_name} --all`
    end
    

    这篇关于使用Dropbox同步文件并在版本控制中备份它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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