0

Is there a proper way to have two separate repositories in GitHub, where I can commit to one regularly and then push changes to another, kind of an intermediary repository?

I'm pretty inexperienced with Git aside from the basics, so forgive me...If we were talking just plain Git, I'd probably think of it as a main branch and a working branch, where I commit to the working branch, then sometimes push all those changes to the main. But I want these to be separate GitHub repos.

Is it possible to push from one to another? Or if that isn't possible, then what would be the best way for me to push my local commits to both repos? And I'd still need the ability to pull changes that other people make in main down to both my local repo and the secondary GitHub repo so that they all stay in sync.

Joe Enos
  • 39,478
  • 11
  • 80
  • 136

1 Answers1

1

Having two entirely separate repositories is usually not something often done in a beginner’s workflow as there isn’t much need for it except in special cases.

There are many different git workflows that could suit your needs.

I think the best workflow for you in this scenario, however, would be forking workflow.

“The main advantage of the Forking Workflow is that contributions can be integrated without the need for everybody to push to a single central repository. Developers push to their own server-side repositories, and only the project maintainer can push to the official repository. This allows the maintainer to accept commits from any developer without giving them write access to the official codebase.”

Other advantages of forming workflow are that it allows for syncing of the “main” repo to the developer’s individual repos so that developers can get their updates without jumping through hoops. Changes to the “main” repo are usually done in the form of pull requests, but if you are the maintainer of the repo you have your own lease to manage it however you want.

yes-siz
  • 348
  • 2
  • 9
  • I'll dig more into forking and pull requests. I always thought forking was just for breaking off into a new project, but it makes sense that it would be used for basically this exact purpose. Thanks. – Joe Enos Jun 20 '20 at 04:35