I have twenty git repositories on github and I want to be able to create a branch in all the twenty repositories with one command or click (without going through to all the twenty repos manually one at a time).
I do understand that I may write a shell script to do that. I am wondering if I am able to utilize sub modules of if there is any other way? Not sure, any help is appreciated.
Considering you can push to multiple repositories at one, you could define in your local repo an remote "all" referencing those 20 repos, create a local orphan branch, and push that branch to "all"
If your branch is supposed to start from an existing branch, then submodules are indeed a better solution, as you might be talking about 20 different repositories, each one with their own existing history.
With a local repo referencing in a .gitmodules
20 repos, you can use (as in here) the git submodule foreach
syntax in order to create and push that new branch (git checkout master; git checkout -b new_branch; git push -u origin new_branch
, wrapped in a script as in this answer)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With