The basic step when committing to open source projects is to fork the project. Then the process is easy you create your branch and you make a pull request. However from time to time you need to adjust you branch based on the latest changes.
This is how you sync your fork to the original one.
This is pretty easy but you might want something more than just synchronizing with the original repository.
For example there might be a pull request which never got merged for various reasons and you wan’t to pick up from where it was left.
The first step is to add the repository needed
So we just added another remote to our repository.
The next step is to fetch the branches from the remote.
Then you can switch to the branch of your choice, continue make a new branch and continue with a pull request.
Remove the upstream
And set the upstream to your original one
Published on Java Code Geeks with permission by Emmanouil Gkatziouras, partner at our JCG program. See the original article here: My most used Git commands on open source projects.
Opinions expressed by Java Code Geeks contributors are their own.