Skip to content

Instantly share code, notes, and snippets.

@mcansh
Last active May 31, 2017 20:11
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 mcansh/6590f9dbbfb5c345b23ba2c5540f4211 to your computer and use it in GitHub Desktop.
Save mcansh/6590f9dbbfb5c345b23ba2c5540f4211 to your computer and use it in GitHub Desktop.
clone repo, cd into it, fork it on github, and open it in atom
# add this to your `~/.bashrc` or `.zshrc` file
# clone repo, cd into it, fork it on github (if its a github repo), and open it in atom
# requires https://hub.github.com for forking and cloning (user/repos)
alias cloneOpen='f() {
urls=('github.com' 'bitbucket.org' 'gitlab.com')
url=$1
for i in "${urls[@]}"
do
if [[ $url =~ $i ]]
then
if [[ $url =~ 'http://' || $url =~ 'https://' ]]
then
userRepo=${url#*://$i/}
elif [[ $url =~ 'git@' ]]
then
userRepo=${url#*@$i:}
fi
repo=${userRepo#*/}
repo_no_ext=$(basename ${repo#*/} .git)
echo $userRepo
echo $repo
echo $repo_no_ext
if [[ $url =~ 'github.com' ]]
then
git clone $url && cd $repo_no_ext && git fork && atom .
else
git clone $url && cd $repo_no_ext && atom .
fi
fi
done
};f'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment