I'm pretty new to Git, and like it a lot so far, but am not sure what do do here.
I've forked a github project, and am currently in the process of porting it to another language. For reference, I've created a branch of the code as it was when I made the fork. My problem now is that the original project has been updated, and I can't figure out how to pull those changes into my branch from the original master (because 'origin' points to my github project).
Follow-up question for my own education, what command will the owner of the original project have to run in order to pull a change in from my branch into his master branch?
EDIT: These answers work when I run them from my own 'master' branch, but not when I run them from my 'tracking' branch (I'm using the term loosely here because I know of a git command of the same name. Not sure what it does, though).
When I'm in my non-master branch, and run git fetch upstream, nothing happens. When I try git fetch upstream:master, it says
ssh: upstream: no address associated with name
fatal: The remote end hung up unexpectedly
You can add the original repo using git remote:
$ git remote add upstream http://github.com/user/repo.git
(You can call it something other than upstream if you want, but that's the name you'll use to refer to the remote.)
To get updates, just run:
$ git fetch upstream
In order to get the changes from your repo into the upstream repo, the maintainer will have to add your repo as a remote, and then pull the changes:
$ git remote add drhorrible http://github.com/youruser/yourrrepo.git
$ git pull drhorrible your-branch:master
Or, if the upstream maintainer doesn't want to add your repo as a remote, he can reference it directly:
$ git pull http://github.com/youruser/yourrepo.git your-branch:master
You can add it to your list of remote repos and fetch/pull from it
$ git remote add first-repo-name git://github.com/first-repo-name/repo.git
$ git fetch first-repo-name
# or:
$ git pull first-repo-name
the git pull will actually merge the first-repo-name master branch to your master branch (if you are currently in that branch)
what command will the owner of the original project have to run in order to pull a change in from my branch into his master branch?
On the GitHub side, this won't be an actual command, but the result of a pull request you would have initiated.

(source: skitch.com)
Technically, he could add your forked repo as a remote repo on his local repo (like you did above), but if his repo is heavily forked, this becomes un-practical, hence the central "pull requests" mechanism.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With