Let\'s assume there is a repository someone/foobar
on GitHub, which I forked to me/foobar
.
How do I pull new commits from
git remote set-url origin git@github.com:someone/foobar
git remote set-url origin --push git@github.com:me/foobar
There is one caveat though:
This is perfect if you are the only one making changes to your fork.
However, if it is shared with other people, you may have to pull from your fork, in which case a separate remote is the only solution.
Edit:
Actually, you can git pull git@github.com:me/foobar
, which removes the caveat.
The choice is yours as to which is easier to remember.
I used a fairly simple method using the GitHub Web UI to do that:
me/foobar
)Open the forked Git repository me/foobar.
Click on Compare:
You will get the notification:
There isn't anything to compare.
someone:master is up to date with all commits from me:master. Try switching the base for your comparison.
Click on switching the base on this page:
Then you get to see all the commits made to someone/foobar after the day you forked it.
Click on Create pull request:
Give the pull request a title and maybe a description and click Create pull request.
On the next page, scroll to the bottom of the page and click Merge pull request and Confirm merge.
Your Git repository me/foobar will be updated.
Edit: rebase options are shown here:
The "Pull" app is an automatic set-up-and-forget solution. It will sync the default branch of your fork with the upstream repository.
Visit the URL, click the green "Install" button and select the repositories where you want to enable automatic synchronization.
The branch is updated once per hour directly on GitHub, on your local machine you need to pull the master branch to ensure that your local copy is in sync.
Also answered in https://stackoverflow.com/a/58965171/946850.
I would simply use:
git pull git@github.com:someone/foobar <branch_name> && git push
Another option is to use the Update from upstreamRepoName/master
button in GitHub for Mac (and I assume GitHub for Windows).