I’m working on a new project in GitHub called Bixo, and recently had to merge in a fork from Chris Wensel. After poking around on the web a bit, I found some very useful information in Willem’s blog post on Remote branches in git.
There was one minor error, though, in the “Merging back a fork” section. After the “git remote add…” command, you have to do a “git fetch <remote>” command to first fetch the remote branches before you can successfully do a “git branch <branch name> <remote/branch>” command.
So in my case, this meant:
% cd git/github/bixo % git remote add chris git://github.com/cwensel/bixo.git % git fetch chris % git branch chris-fork chris/master
And once that worked, I could merge from his branch to mine, and push back the changes.
Slowly but surely the git model accretes in my head.
Thanks Ken — needed to figure out how to merge my fork, worked like a charm 🙂
You didn’t have to branch it first. You could simply do
% cd git/github/bixo
% git remote add chris git://github.com/cwensel/bixo.git
% git merge chris/master
Hi Sorcix,
You’re right, and Willem also updated notes on his page about this shortcut. He includes info how to switch to the remote branch for testing, which is handy. Specifically:
% git remote add chris git://github.com/cwensel/bixo.git
% git fetch chris
% git checkout chris/master
Now test Chris’s modifications
% git checkout master
% git merge chris/master
Thanks, worked great!