Skip to content

Instantly share code, notes, and snippets.

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 timb-machine/8c7385b478c6087bb21090e3c823cd12 to your computer and use it in GitHub Desktop.
Save timb-machine/8c7385b478c6087bb21090e3c823cd12 to your computer and use it in GitHub Desktop.
Bulk rename my mirror repos to reference original org
gh repo list timb-machine-mirrors --fork -L 1230 --json name | tr "," "\n" | cut -f 4 -d "\"" | while read line
do
org=`gh repo view timb-machine-mirrors/$line --json parent | tr "," "\n" | grep login | cut -f 4 -d "\""`
name=`gh repo view timb-machine-mirrors/$line --json parent | tr "," "\n" | grep name | cut -f 4 -d "\""`
if [ "$line" != "$org-$name" ]
then
gh repo rename -y -R "timb-machine-mirrors/$line" "$org-$name"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment