Reputation: 5210
I am forking from
which results in
from where I clone it and checkout the branch (I am interested in) to my local machine.
My issue is that I would like to fetch the latest branch (master-1.2.x) from the remote repository (mantisbt/mantisbt) and merge it under the same branch the to my local repository.
Which would result in something like
How is this done?
UPDATE:
content is fetched with
and merged to currently checked out branch with
Upvotes: 4
Views: 9694
Reputation: 183
What just no worked for me (git version 1.7.9.5 and using HTTPS protocol):
Originally I forked "foobar.git" from "their account" to "my account":
their_account/foobar.git => my_account/foobar.git
The branch of interest is "baz"
I worked and made commits on "baz" and they did too. I wanted to merge their commits with mine. As ptomli suggested above, I did:
$ git checkout baz
$ git fetch https://github.com/their_account/foobar.git baz
Username for 'https://github.com': my_account
Password for 'https://my_account@github.com':
remote: Counting objects: 189, done.
remote: Compressing objects: 100% (109/109), done.
remote: Total 189 (delta 92), reused 151 (delta 76)
Receiving objects: 100% (189/189), 107.77 KiB, done.
Resolving deltas: 100% (92/92), done.
From https://github.com/their_account/foobar
* branch baz -> FETCH_HEAD
The step that I did not see noted was:
$ git merge FETCH_HEAD
and the two branches were merged.
Upvotes: 0
Reputation: 11818
Github has an example of exactly this in their "fork a repo" help documentation.
git remote add upstream git://github.com/mantisbt/mantisbt
// Assigns the original repo to a remote called "upstream"
git fetch upstream
Upvotes: 8