Collection of my little helpers...
Sample url: https://github.com/kaestnjas/Scripts.git
Carefully (!), its only working with simple urls like above. Urls containing additional directories or dots like below wont work:
https://github.com/kaestnjas/projects/Scripts.git;
https://github.com/kaestnjas/Scripts.wiki.git;
url=https://github.com/kaestnjas/Scripts.git;
dir=$USERPROFILE'\source\repos\'"$(cut -d'/' -f3 <<<$url)"'\'"$(cut -d'/' -f4 <<<$url)";mkdir -p "$dir" && cd "$dir" && git clone $url && cd "$dir"/"$(cut -d'.' -f1 <<<$(cut -d'/' -f5 <<<$url))" && git config credential.helper store && git fetch --all && git pull
cd "$dir"/"$(cut -d'.' -f1 <<<$(cut -d'/' -f5 <<<$url))" && git config credential.helper store && git fetch --all && git reset --hard origin/master && git pull;cd $USERPROFILE'\source\repos\' && find . -type d -name .git -not -wholename "*kaestnjas/Scripts*" -not -wholename "*kaestnjas/Scripts.wiki*" -execdir sh -c "pwd && git config credential.helper store && git stash && git fetch --all && git clean -d -f && git pull" \;
Which does not use the same "/mnt/c/Users/" folder, as the two others shells and commands will inviseble do). This is, to prevent problems with diffrent line endings, using diffrent software and a like. But it would be possible, if changing "~" to your Windows user profile path with "/mnt/" in front of.
url="https://github.com/kaestnjas/Scripts.git"
dir=~/source/repos/"$(cut -d'/' -f3 <<<$url)"/"$(cut -d'/' -f4 <<<$url)";mkdir -p "$dir" && cd "$dir" && git clone $url && cd "$dir"/"$(cut -d'.' -f1 <<<$(cut -d'/' -f5 <<<$url))" && git config credential.helper store && git fetch --all && git pull
cd "$dir"/"$(cut -d'.' -f1 <<<$(cut -d'/' -f5 <<<$url))" && git config credential.helper store && git fetch --all && git reset --hard origin/master && git pull;cd ~/source/repos/ && find . -type d -name .git -not -wholename "*kaestnjas/Scripts*" -not -wholename "*kaestnjas/Scripts.wiki*" -execdir sh -c "pwd && git config credential.helper store && git stash && git fetch --all && git clean -d -f && git pull" \;
PS:
$url="https://github.com/kaestnjas/Scripts.git"
$dir = "$env:USERPROFILE\source\repos\"
todo: how to cut the url to pieces with PS
PS:
dir=$USERPROFILE'\source\repos\'"$(cut -d'/' -f3 <<<$url)"'\'"$(cut -d'/' -f4 <<<$url)";mkdir -p "$dir" && cd "$dir" && git clone $url && cd "$dir"/"$(cut -d'.' -f1 <<<$(cut -d'/' -f5 <<<$url))" && git config credential.helper store && git fetch --all && git pull
PS:
cd "$dir"/"$(cut -d'.' -f1 <<<$(cut -d'/' -f5 <<<$url))" && git config credential.helper store && git fetch --all && git reset --hard origin/master && git pull;cd $USERPROFILE'\source\repos\' && find . -type d -name .git -not -wholename "*kaestnjas/Scripts*" -not -wholename "*kaestnjas/Scripts.wiki*" -execdir sh -c "pwd && git config credential.helper store && git stash && git fetch --all && git clean -d -f && git pull" \;