When you want to change/contribute to other people’s projects that you don’t have access to you usually fork the project, and then use your read+write fork.
What if you first cloned their repo and made local commits that you now want to contribute? You don’t want to mess with patches, so here’s what I did to contribute a small fix to the example project from Apache Maven 2 Effective Implementation, a great book by Brett Porter and Maria Odea Ching.
- Fork the project repo at Github (at https://github.com/brettporter/centrepoint/)
- The original read only url was https://github.com/brettporter/centrepoint.git
- My fork url is now firstname.lastname@example.org:carlossg/centrepoint.git
- In my local clone, I renamed the remote origin to upstream
- Add a new remote called origin pointing to the read+write fork
- Change the master branch remote to origin instead of upstream
- Fetch the remote and push your changes
git remote rename origin upstream git remote add origin email@example.com:carlossg/centrepoint.git git fetch origin git branch --set-upstream master origin/master git push origin