How to backup a local Git repository?

前端 未结 8 1199
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 08:08

I am using git on a relatively small project and I find that zipping the .git directory\'s contents might be a fine way to back up the project. But this is kind of weird bec

8条回答
  •  梦谈多话
    2020-11-22 08:24

    [Just leaving this here for my own reference.]

    My bundle script called git-backup looks like this

    #!/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 /data/Dropbox/backup/git-repos/#{bundle_name} --all`
    end
    

    Sometimes I use git backup and sometimes I use git backup different-name which gives me most of the possibilities I need.

提交回复
热议问题