Last active
November 28, 2016 17:15
-
-
Save alabeduarte/3199c5f96d19c67ec3e3 to your computer and use it in GitHub Desktop.
clone or pull git repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function clone_or_pull () { | |
root_dir=`pwd` | |
if [ -d $1 ]; then | |
echo "Prepare to pull the latest version of $1" | |
cd $1 | |
git pull origin master | |
else | |
echo "Prepare to clone $1" | |
git clone [email protected]:$1.git | |
fi | |
pwd | |
echo "Going back to $root_dir" | |
cd $root_dir | |
} | |
# usage: | |
# clone_or_pull alabeduarte/feedparser-promised |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment