Last active
April 24, 2020 14:12
-
-
Save stefanofiorentino/c83da326050a98f3f26311a61d46b582 to your computer and use it in GitHub Desktop.
git tag all repository in the current workdir
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
#!/bin/bash | |
if [[ ${1} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] | |
then | |
for dir in $(find . -maxdepth 1 ! -path . -type d); | |
do | |
cd $dir | |
find . -type d -name '.git*' ! -path "*/poky-tmp/*" 2>/dev/null | \ | |
sed 's/\.git$//g' | \ | |
xargs -I '{}' sh -c 'readlink -e {};' | \ | |
uniq | \ | |
sort | \ | |
xargs -I '{}' sh -c 'cd {}; echo "$(pwd) $(git config --get remote.origin.url) $(git rev-parse HEAD)"; echo git tag -a '${1}' -m ""'; | |
cd .. | |
done; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment