您的位置:首页 > 其它

Git_Clone a remote git repository and cd into it

2012-08-24 14:11 381 查看
First, clone a remote git repository and cd into it:

$ git clone git://example.com/myproject
$ cd myproject

Next, look at the local branches in your repository:

$ git branch
* master

But there are other branches hiding in your repository! You can see these using the
-a
flag:

$ git branch -a
* master
origin/HEAD
origin/master
origin/v1.0-stable
origin/experimental

If you just want to take a quick peek at an upstream branch, you can check it out directly:

$ git checkout origin/experimental

But if you want to work on that branch, you'll need to create a local tracking branch:

$ git checkout -b experimental origin/experimental

Now, if you look at your local branches, this is what you'll see:

$ git branch
master
* experimental

You can actually track more than one remote repository using
git remote
.

$ git remote add win32 git://example.com/users/joe/myproject-win32-port
$ git branch -a * master origin/HEAD origin/master origin/v1.0-stable origin/experimentalwin32/master
win32/new-widgets

At this point, things are getting pretty crazy, so run
gitk
to see what's going on:

$ gitk --all &
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐