Contributing to a GitHub repo

If you are part of a larger project that is hosted on GitHub, and have cloned that master repo to your own, you will eventually have to push your changes to the master and pull other people’s changes back into your own, and that means you eventually will have to deal with conflicts. Here’s how:

Let’s call the master repo the “Main Master”. Your clone is called simply your “master”. After you clone the Main Master to your own repo, creating master, clone that branch into your own “main-master” branch. Now you have two branches in your repo, “master” and “main-master”. Make all of your changes in master, never touching main-master directly.

When you’re ready to send your changes back to Main Master, do a pull request from the Main Master repo back to your main-master branch first. If there are any changes there, merge main-master back into master and deal with any conflicts. Once master is good, set up a pull request of your master back to Main Master. Whoever is managing Main Master should be able to merge your changes automatically.

What you’ve done is set up a circle for pull requests: Main Master -> main-master branch -> master branch -> Main Master

If you follow this cycle, any conflicts that occur will happen locally when you try to merge main-master into master, and you can deal with them easily.