Skip to content

Instantly share code, notes, and snippets.

@dscape
Forked from mmalecki/fetch.sh
Created July 19, 2013 21:22
Show Gist options
  • Save dscape/6042449 to your computer and use it in GitHub Desktop.
Save dscape/6042449 to your computer and use it in GitHub Desktop.
#!/bin/sh
username=$1
git remote -v | grep "$username"
if [ $? -ne 0 ]; then
project=`git ls-remote --get-url | sed 's/.*\/\([a-z]*\).git/\1/g'`
git remote add "$username" "https://github.com/$username/$project.git"
fi
git fetch "$username"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment