MarkUs Blog

MarkUs Developers Blog About Their Project

Git tips on How to Pull a Branch

without comments

This blog post takes the assumption that you setup your folk using How to use git with MarkUs blog post.

From the previous blog, to update our local master branch we used:

$ git checkout master
$ git pull markus-upstream master

What this does is pull and merge the changes from the location markus-upstream and from the master branch into your current local branch. Thus following this format.

$ git pull {repo} {remotebranchname}

So if we want to pull someones branch there are 2 ways it can be done

1) Pull to a local branch that already exists

  • This method will be very similar to above. First do a git checkout to the branch
    $ git checkout branch123
  • Second do a git pull on what you want to pull from
    $ git pull {repo} {remotebranchname}
  • Example
    Say someone want to pull my branch123 and place it in there local branch Michael-123fix

    $ git checkout Michael-123fix
    $ git pull git://github.com/mikeing2001/Markus.git branch123

2) Pull to a new branch that hasn’t been created yet

  • If the branch has not been created then the steps can be combine into one.
    $ git pull {repo} {remotebranchname}:{localbranchname}
  • Example
    Say someone want to pull my branch123 and place it in there local branch Michael-123fix

    $ git pull git://github.com/mikeing2001/Markus.git branch123:Michael-123fix

With the above 2 methods you can also replace the git url with a remote like we did with markus-upstream
$ git remote add mikeing2001-markus-branch git://github.com/mikeing2001/Markus.git

Written by mikeing2001

October 13th, 2012 at 2:35 pm

Leave a Reply