Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to make the same change in multiple GitHub repos

A concrete example how I automated a chore update of multiple repostitories that I do not own => to create pull requests (PRs) with the same simple change in each repo.

copy([
  ...new Set($$('h1 > a[href^="/kentcdodds/"]').map(el => `gh repo fork ${el.href}.git --clone --remote`))
].join('; '))
  • paste the shell command, review, and execute in the new directory
  • review that you have correct repos
  • display your browser and bash terminal side by side
  • make the small change in each directory and open new PRs in browser tabs (to review each before submitting)
ls -d */ | xargs -I {} bash -c "cd '{}' \
&& echo '.eslintcache' >> .gitignore \
&& git add . \
&& git commit -m 'chore: ignore .eslintcache' \
&& git push \
&& gh pr create --web"

Note: the double >> is important if you want to only modify the last line of file and not modify whole file with single >. Of course, you also need to modify your commit message to match your change 😉

@Aprillion

This comment has been minimized.

Copy link
Owner Author

@Aprillion Aprillion commented Dec 30, 2020

FTR this was a workaround for facebook/create-react-app#10161

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment