Skip to content

Instantly share code, notes, and snippets.

@jkribeiro
Last active October 27, 2017 15:27
Show Gist options
  • Save jkribeiro/d3f8ebd8702eb960d127174c7a14b1fd to your computer and use it in GitHub Desktop.
Save jkribeiro/d3f8ebd8702eb960d127174c7a14b1fd to your computer and use it in GitHub Desktop.
Script to push a blank commit to a list of repositories and branches.
#!/bin/bash
GITHUB_ORG="<org>"
REPOS="
<repoA>
<repoB>
"
BRANCHES="
<branchA>
<branchB>
<branchC>
"
# Iterate repos.
for repo in `echo ${REPOS}`; do
# Clone repo.
echo "Cloning ${repo}"
git clone "[email protected]:${GITHUB_ORG}/${repo}.git"
cd "${repo}"
# Iterate branches.
for branch in `echo ${BRANCHES}`; do
# Chekout branch.
git checkout "${branch}"
# Trigger blank commit.
git commit --allow-empty -m "Trigger notification"
# Push commit.
git push origin "${branch}"
done
# Remove repo.
cd ..
rm -rf "${repo}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment