GitHub/Bitbucket tips for those that reuse plugins in client projects


Do you reuse commercial plugins and themes with different clients? I know I do. I also like to create a Bitbucket account per client that I manage. This is so the client owns in a manner of speaking his or hers own data and code. This could create a bit of a hassle when updating plugins to a new version in the Bitbucket/Github repository since each plugin has it’s own repository since I also handle all WordPress installations with Composer.

How to I solve the hassle of updating multiple repositories with one command?

That actually have a pretty simple solution. Each git repository can have multiple remote storage locations, so I just add each clients repository as a new origin.

git remote add client1

You can have as many remote locations as you want if you make sure to give each a unique name. I use the clients name.

So now that you have added multiple remotes how do you push them?

That is also easy. Just add a git alias. The following command alias will push all local branches to all detected remote locations when you run “git pushall”. If you are on Windows and not Mac or Linux you need to change the command accordingly, or find some tool like Cygwin or using Bash shell (I do not use Windows personally).
git config --global alias.pushall '!git remote | xargs -L1 git push --all'

If you just want to push a specific branch replace “–all” with the name of the branch.If you for example have your own repository with multiple branches you might not want to push those to all remotes. In that case making a new alias such as pushmaster that only pushes the master branch is an good option.
git config --global alias.pushmaster '!git remote | xargs -L1 git push master'

Share on facebook
Share on twitter
Share on linkedin
Share on email

Recent posts

Recommended Services

We use Cloudways to host this site