I found a lot of q about synchronizing a forked git repository with the original remote repository, but none of them apply to my exact problem.
Suppose I forked a project with the remote name upstream, my fork name is the beginning. I have a master and branch dev locally, which is a master track and dev origin.
While I am not making any changes to my forked repo, I know that I can synchronize the forked repo by origin using upstream / master
git checkout master git pull upstream master git push origin master
So far so good. But now I am working on my local dev branch, and as soon as I finish, I would like to merge it with my local master. But first, I would update my local master with upstream changes
git checkout master git pull upstream master git push origin master
First question (s) : Is that right? But what should I do with my local branch? Restore it on my updated host before merging it into a local master or try combining it without rebooting? Or should I try to keep my local developer in sync with the upstream / downstream all the time, occasionally upstream / downstream?
Once this is done, I would
git push origin master
and remove the dev branch, locally and at the beginning. But now my host (locally and by origin) deviates from the upstream / main by the changes made by my local developer.
Second question : What is the right way to synchronize with the upstream / downstream? I'm still just doing
git checkout master git pull upstream master git push origin master
or something else recommended here (for example, some form of reinstallation)? If I created the dev branch again, would I apply the same strategy that was used for the first question, or is something else applicable?
Thank you for your help!