Skip to content

Instantly share code, notes, and snippets.

@stefanofiorentino
Last active April 24, 2020 14:12
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 stefanofiorentino/c83da326050a98f3f26311a61d46b582 to your computer and use it in GitHub Desktop.
Save stefanofiorentino/c83da326050a98f3f26311a61d46b582 to your computer and use it in GitHub Desktop.
git tag all repository in the current workdir
#!/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