Using Dropbox to synchronize files and having them backed up in version control

前端 未结 1 1980
忘了有多久
忘了有多久 2020-12-17 05:33

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
相关标签:
1条回答
  • 2020-12-17 05:57

    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
    
    0 讨论(0)
提交回复
热议问题