Reputation: 4418
I have a forked repo origin
with some changes and the upstream
repo has some new changes. I don't want to merge my commits at this moment, but instead I wanted to create a new branch which has the same HEAD as that of upstream
. Like forking the upstream
into a new branch.
Upvotes: 1
Views: 26
Reputation: 1329092
You can fetch upstream and declare a branch from (for instance) upstream/master
:
git fetch upstream
git checkout -b mybranch upstream/master
Or, if you don't want to switch to the new branch:
git branch --set-upstream mybranch upstream/master
Don't forget that a good practice is to rebase your changes on top of upstream/master
, in order to make any future pull request easy to integrate (fast-forward merge)
Upvotes: 1