Keeping code on GitHub and

Posted on 22/08/2016 encourages developers to host all of their Drupal-related Open Source code directly on This is great, because all your OS code will be associated with your account and you will get a lot of extra features such as issue tracking, release publishing, ability to reference other issues and so on. However, current interface of website is not the most user friendly, especially when you want to have a quick look at the code of a contrib module.

This is why I think developers should host mirror repositories on another service where the source code can easily be checked through the browser. Why would anyone want to do this? Well, there are dozens of modules that revolve around using one simple hook to achieve certain functionality for example. If you are developing your module, you might want just to check how was that hook used in the contrib module, so you can adjust the code for your project.

To set this up, you will need 2 remote destinations: one on GitHub (or Gitlab, BitBucket, etc.) and the second one on To keep things simple and self-explanatory, I suggest naming them just like that - github and drupal.

Here's how to set proper destinations:

  1. # Add GitHub source.
  2. git remote add github
  3. # Add source for a full project.
  4. git remote add drupal
  5. # OR Add source for a sandbox project.
  6. git remote add drupal

Do note that your git username on can be different than the one you use for logging in to You can check your username by logging to, going to your profile page and then going to "Edit" -> "Git access".

Now when you want to push the code, here's what you need to do;

  1. # Push the code on GitHub.
  2. git push github
  3. # Push the code on
  4. git push drupal

If for whatever reason you want to push one branch into another (e.g. local master to 8.x-1.x on, here's how to do that:

  1. git push drupal master:8.x-1.x

That's it!

Last thing: do bear in mind that contributions by other members are easier to track through issues on If your project is used by others as well, use issue tracking system to be fair to contributors.