![]() ![]() When 2 : puts 'Warning: Multiple entries of backup.directory found in your git config file. Defaulting to the same directroy your git repo is in: ' + directory See "man git config" for more details on git configuration files. ![]() Puts 'Warning: Could not find backup.directory in your git config file. # git config adds a newline, so remove it # -ĭirectory = `git config -get backup.directory` # get the setting for the backup directory # if exaclty one key is found once, it's value is send to stdin # if the key exists multiple times, the last value is send to stdin # if the key does not exist, an empty string is send to stdin # if the key exists twice in the same file with 2 # if the key does not exist git config exits with 1 # git-config -get of version 1.7.10 does: Raise( 'fatal: Directory still not a git repo: ' + Dir.pwd ) Unless File::directory?( Dir.pwd + '/.git' ) Until File::directory?( Dir.pwd + '/' + git_dir_name ) \ git or at least cannot get zero exit status from "git status"' Git_dir_name = '.git' # just to avoid magic "strings"įilename_suffix = ".git.bundle" # will be added to the filename of the created backup only keep 3 backups for a repo - like rotate.) # - propose to make backup directory if it does not exists # - if multiple entries found in config file, specify which file # - do better checking for git repo than calling git status # - check the standard format of git warnings to be conform # - make it a class rather than a function # For documentation please sea man git-backup(1) Welcoming all suggestions and pull request on github. I started hacking away a bit on Yar's script and the result is on github, including man pages and install script: Then, I just run git bak whenever I want to do a backup. I made an alias to do the push: git config -add alias.bak "push -mirror github" This is the default if the configuration option remote.mirror is set. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. Instead of naming each ref to push, specifies that all refs under $GIT_DIR/refs/ (which includes but is not limited to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the remote repository. I use this for creating backups of my local repository. This will push all refs (branches and tags) including non-fast-forward updates. The way I do this is to create a remote (bare) repository (on a separate drive, USB Key, backup server or even github) and then use push -mirror to make that remote repo look exactly like my local one (except the remote is a bare repository). Yar's current solution uses a git bundle. Use git bundle if you want to back up to your dropbox. You will have sync errors, and you CANNOT ROLL A DIRECTORY BACK IN DROPBOX. ![]() If you look at the history of edits of the OP Yar answer, you would see that Yar used at first a clone -mirror. Warning: I wouldn't recommend Pat Notz's solution, which is cloning the repo.īackup many files are always more tricky than backing up or updating. (It is an atomic operation, as opposed to making an archive from the. Useful for incremental backup and restore.īut if you need to backup everything (because you do not have a second repo with some older content already in place), the backup is a bit more elaborate to do, as mentioned in my other answer, after Kent Fredric's comment: $ git bundle create /tmp/foo master That will create a file that supports git fetch and git pull to update your second repo. The other official way would be using git bundle ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |