Cerin Cerin - 1 year ago 85
Git Question

How to pull updates from parent Git repo after forking?

There was a Git repo A which I forked into repo B, made bug fixes, then submitted back to A as a pull request. However, the author ignored my fixes (fair enough) but they've since published other bug fixes which I'd like to incorporate into my fork B while maintaining my separate fixes.

What's this procedure formally called in Git nomenclature, and how do I do it? Is this what a "remote" is? I've added a remote, but I can't figure out how to pull changes from it.

Answer Source

If you haven't configured a remote for fork A yet in Git, do so via:

git remote add fork_a http://path/to/repo

where http://path/to/repo is a URL to the fork wherever it is being hosted (e.g. GitHub, Bitbucket).

Now all you need to do is git pull to bring the changes from the A fork into your local branch. If your local branch were called master, you'd do one of the following:

git checkout master
git pull fork_a master           # merge changes in
# or
git pull --rebase fork_a master  # rebase on the fork
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download