I'm quite new to Git and GitHub, so please help me with this question!
I want to contribute to a github project, so I did the following steps:
- I forked the original repository (the so called
upstream
, right?) - I git cloned my fork locally (
git clone 'myforkrepo'
) - I created a new branch to work on a new feature (
git switch -c myfeatureA
) - I also created a new branch from main to work on another separate feature (
git switch main
and thegit switch -c myfeatureB
) - I was working on my local branches when I realised that, meanwhile, the upstream main was updated!
- I read about Syncing a fork - GitHub Docs and I added the original repo as upstream, switched to my local main and **merged **(
git merge upstream/main
) (Or should I rebase?).
Now, my question is: since I need to update all my local branches to the upstream main in order to make pull requests, do I have to merge upstream/main with each local branch? Or do I have to merge the local main with all the branches? And How to update my remote fork?