Skip to content

Instantly share code, notes, and snippets.

@tarranjones
Created January 6, 2017 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarranjones/e640df8f429a6a2dc1f4e7006b894583 to your computer and use it in GitHub Desktop.
Save tarranjones/e640df8f429a6a2dc1f4e7006b894583 to your computer and use it in GitHub Desktop.
Archives a a git repository in $HOME/{hostname}/{username}/{repository} and optionally creates a symlink to the git directory
archive_repo(){
mkdir -p ~/$1
if ! git -C ~/$1 pull; then
git clone https://$1.git ~/$1
fi
if [ ! -z "$2" ]; then
mkdir -p $2
rm -rf $2
ln -s ~/$1 $2
fi
}
@tarranjones
Copy link
Author

Usage

$ archive_repo github.com/zsh-users/antigen .antigen

PhpStorm Framework Integration

$ archive_repo github.com/wordpress/wordpress
$ archive_repo github.com/joomla/joomla-cms
$ archive_repo github.com/drupal/drupal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment