./ml.sh -b master python3 test.py
Last active
April 15, 2021 09:41
-
-
Save creotiv/0d296ec8d8e576a4d2253960580257b5 to your computer and use it in GitHub Desktop.
Script to run ml code from git in parallel without changing branch
This file contains hidden or 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
if [ ! -d ".git" ]; then | |
echo "Error: Git not initialized. Maybe running not from root dir?" | |
exit 0 | |
fi | |
if ! grep -q .run/ ".gitignore"; then | |
echo -e "\\n.run/" >> .gitignore | |
fi | |
path=./.run/ | |
while getopts ":b:" flag; do | |
case "${flag}" in | |
b) branch=${OPTARG};; | |
esac | |
done | |
cmd=${@:3} | |
path=$path$branch | |
rm -rf $path | |
mkdir $path | |
git clone --shared --branch $branch ./ $path | |
rm -rf $path/.git | |
base=$(pwd) | |
cd $path && BASEPATH=$base $cmd || cd ../../ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment