I forked a GitHub project. I want to create a new branch, that is a clone of the original project's master branch (the master branch has new commits from when I last forked).
How can I do this?
I forked a GitHub project. I want to create a new branch, that is a clone of the original project's master branch (the master branch has new commits from when I last forked).
How can I do this?
Fetch from your upstream, checkout to that branch, then force push to that branch on your fork.
git fetch upstream
git checkout <target branch>
git push -f origin <target branch>
Disclaimer: I haven't tested this.
First you need to configure a remote for a the original repo.
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
$ git fetch upstream
Now you can use any git command with any branch from the original repo.
$ git checkout master
$ git pull upstream master
Of course, you can checkout any other branch than master.
$ git checkout my-radical-new-feature
$ git pull upstream master
Typically I pull directly to my local master branch as shown here and then merge the local master into other branches where I am working.
$ git checkout master
$ git pull upstream master
$ git checkout my-radical-new-feature
$ git merge master
See the GitHub docs for more details