Skip to content

Commit

Permalink
adding git-backup to the scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
markhuot committed Jul 10, 2017
1 parent 4e85ad8 commit 37ac4b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions bin/cog-git-backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Git clone a remote repository to a local folder
# and then checkout all remote branches so you have
# a complete backup

set -e

: ${1?Must pass a Git URL as the first param}
: ${2?Must pass folder to backup to}

REMOTE=$1
FOLDER=$2

git clone $REMOTE
pushd $2
for remote in `git branch -r | grep -v /HEAD | grep -v /master`; do git checkout --track $remote ; done
git checkout master
popd
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"cog-serve": "./bin/cog-serve",
"cog-tag": "./bin/cog-tag",
"cog-update": "./bin/cog-update",
"cog-watch": "./bin/cog-watch"
"cog-watch": "./bin/cog-watch",
"cog-git-backup": "./bin/cog-git-backup"
}
}

0 comments on commit 37ac4b5

Please sign in to comment.