Skip to content

Instantly share code, notes, and snippets.

@gtramontina
Created September 4, 2014 06:50
Show Gist options
  • Save gtramontina/34fd3223ff754f13df56 to your computer and use it in GitHub Desktop.
Save gtramontina/34fd3223ff754f13df56 to your computer and use it in GitHub Desktop.
git_clone_or_pull '<remote_path>' '<local_repo_dir>'
git_clone_or_pull() {
local REPOSRC=$1
local LOCALREPO=$2
local LOCALREPO_VC_DIR=$LOCALREPO/.git
if [ ! -d $LOCALREPO_VC_DIR ]; then
git clone --recursive $REPOSRC $LOCALREPO
else
pushd $LOCALREPO
git pull $REPOSRC && git submodule update --init --recursive
popd
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment