Reputation: 1519
In the context of my question, I have a fork origin\master
branch from upstream\master
branch of a certain project.
My origin
project is a completely stand alone project, which have new features, and I would never want to create a pull request to upstream\master
. However, I want to get updates from upstream\master
and stay synced to it.
In this scenario, origin\master
is the master
branch of my project, so it's supposed to be the most stable branch, and I would like to protect it, and restrict push operations to it. (restricted branches)
But if I understand it right, If I want to sync with upstream\master
, I'm getting the changes to a local master
branch of my project, and after resolving conflicts I need to push it to origin\master
, which is a restricted branch - so I can't actually do that. In addition, I can't create a pull request from local master
to origin\master
due to the same restriction..
More generally speaking, intuitively it doesn't feel right to me to merge from upstream\master
directly to origin\master
.
Does anyone know if there is a better strategy for a scenario like that?
Upvotes: 0
Views: 140
Reputation: 38106
As your local master
branch is the working copy of origin/master
, so you need to sync local master
with origin/master
. And it’s not make sense to sync origin/master
with upstream/master
directly.
If your origin/master
branch protected not pushing to remote directly, you can create another branch and push it to remote, then create a pull request to merge it into master
. Details as below:
#After you update local master to sync with upstream/master
git checkout -b temp
git push -u origin temp
In the github web page -> create a pull request -> merge temp
branch into master
-> finally the origin/master
will has the update in upstream/master
branch.
To sync local master
branch with origin/master
:
git checkout master
git pull origin master
Upvotes: 1