Skip to content

Instantly share code, notes, and snippets.

@jwhitlark
Created February 28, 2019 19:17
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 jwhitlark/9d2e78a9f1d845a2b6788bd662ffc5a5 to your computer and use it in GitHub Desktop.
Save jwhitlark/9d2e78a9f1d845a2b6788bd662ffc5a5 to your computer and use it in GitHub Desktop.
Autoclone ...xyz/$GITUSER/$GITREPO into the current directory, when direnv is installed.
PARENT=$(basename $PWD)
GRANDPARENT=$(basename $(dirname $PWD))
REPOPATH=$GRANDPARENT/$PARENT
if [ ! -d .git ]; then
echo "Cloning $REPOPATH into $PWD"
tfile=$(mktemp /tmp/envrc.XXXXXXXXX)
mv .envrc $tfile
git clone https://github.com/$REPOPATH.git ./
mv $tfile .envrc
fi
@jwhitlark
Copy link
Author

jwhitlark commented Feb 28, 2019

If it does exist, tell me if I'm up to date with origin and upstream? Probably can be done with a git prompt thing.

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