SciLifeLab/scilifelab — pull request #331 by guillermo-carrasco (2013-11-14 15:40:17+00:00)
Title: Script to backup all our repositories

This script can be used to clone all the repositories from a GitHub user:

```
(github)guillem@guillemmac:~/repos/scilifelab/scripts (github)$ python backup_github.py --help
usage: backup_github.py [-h] [-d D] user

Clones all the public repositories from a GitHub account

positional arguments:
user GitHub username

optional arguments:
-h, --help show this help message and exit
-d D Destination of the copy
```

[Here](http://pastebin.com/0juZiwW5) you can find the output of the first execution of ```backup_github.py SciLifeLab -d backup```.
[Here](http://pastebin.com/bHgzLcek) the output of a second execution, where all branches are updated.

*Note*: I know that the embedded bash command is not the most beautiful thing, but is the only way I found to track all branches so that we can pull from them later. The thing is that if you do a ```git clone```, this is a complete backup containing everything: commit history, tags, branches, etc. **But**, if the repository already exists you cannot clone, and what you have to do is pull from all branches. And here is the problem, you cannot pull form branches that you haven't previously tracked. So that's why this dirty bash command that tracks all the runs, so that ```git up``` can later on pull from all branches.