On Fri, 6 Jul 2012 23:17:01 +0800
lei yang <yanglei.f...@gmail.com> wrote:

[...]
> > 1) Make a certain branch from a certain (remote) repository to
> > appear in your local repository.
> 
> Yes this one,make the branch from remote to be as my local branch
This is simple.
But the steps to perform depend on what you really need to achieve.

If you just want a one-off action, that is, to bring that branch to your
local repo as it looks now and then do not ever touch it--I mean, you do
not want to follow any remote changes which that branch might receive in
the future--then you can just use the so-called "refspec" with the `git
fetch` command:

$ git fetch <remote> refs/heads/thatbranch:refs/heads/thisbranch

will create the branch named "thisbranch" in your local repository, and
this branch will have the history of the branch "thatbranch" from the
remote repository <remote>.  This remote might be a "named
remote" (that is, created previously with the `git remote add` command)
or just an URL (as used with the `git clone` command).
More info on this is in the `git fetch` manual page, as usually.

If you want instead to actually track the developments on that branch
after you bring it to your repository, you should take the route
described in [1] and [2], that is, add a named remote, fetch from it
(this will create the so-called "remote-tracking branches" for that
remote's branches in your local repository) and then optionally fork
your own local branches off those remote-tracking branches.

1. http://git-scm.com/book/en/Git-Basics-Working-with-Remotes
2. http://git-scm.com/book/en/Git-Branching-Remote-Branches

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.

Reply via email to