Excellente question
Je me suis aussi posĂ© la question et jâai fouillĂ© un peu pour trouver la rĂ©ponse donc jâai eu le rĂ©flexe de faire un bout de doc pour la prochaine fois que jâen aurai besoinâŠ
To keep up-to-date with the original code, we are going to add a remote directory. Choose a meaningful name (I often use âofficialâ). Find the HTTPS clone URL from the original project and type (inside the git folder):
> git remote add <name> <URL>
> git remote -v
The second line shows you your remote directories. Now you can fetch (pull) or push from and on two distinct remote repositories (origin being the one you initially cloned from). To update your robot and your github, first get the latest code from the new remote, then push it on your github repo:
> git pull <name> master
> git push origin master
If you try to push to the original code remote, you will get a âforbiddenâ error.
Et aussi un bon conseil pour la suite:
If you have only a few minor modifications to do, you can keep it that way: change the code, commit and push in this directory, then go to GitHub to do a âpull requestâ.
But if you have multiple modifications to do on different subparts, you may want to separate them. This will also easy the work of the owner of the original project: he will be able to integrate small, consistent modification one at a time instead of having to test all your modifications and accept all of them or none of them.
So letâs go branching. A branch is a different copy of the same git directory that allows you to modify things and easily go back to previous, stable state.
Create a branch (branch named test-branch for the example, call it something meaningful) and add it to your GitHub repo:
> git checkout -b test-branch
Now if you commit, it commits in the branch. Push in the branch:
> git push origin test-branch
You can now make a pull request to the original code with your branch and start another branch to keep working while your pull request waits for acceptance.
Tout ça devrais ĂȘtre intĂ©grĂ© un jour (prochain) dans une doc pour dĂ©veloppeurs.