一点点git的分支知识(more about git branch )

发布时间: 2013-03-06 01:12:00

$ git branch -a 的结果: ( this morning, I ran a GIT command and got its result: )

sg552@youku:/sg552/workspace/m-cms$ git branch -a
* master
  remotes/origin/HEAD -> origin/master

我很好奇, origin/HEAD 和 origin/master 都是啥,两者有啥关系。搜索了一下,发现: origin/HEAD是默认的checkout 分支。 HEAD-》 master 表示 默认的分支就是origin/master. ( I am curious about what are the HEAD and origin/master, what relationship is between them. after googling around, i found that origin/HEAD is the default cloned branch , and it's pointing to origin/master in my case )

命令: git remote show origin 可以显示本地和远程的origin 上的分支情况 ( command $ git remote show origin lists the branches in local and remotely )

sg552@youku:/sg552/workspace/m-cms$ git remote show origin
* remote origin
  Fetch URL: ssh://[email protected]:22022/gitroot/m-cms
  Push  URL: ssh://[email protected]:22022/gitroot/m-cms
  HEAD branch: master
  Remote branches:
    master       tracked
    siwei_branch tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local refs configured for 'git push':
    master       pushes to master       (up to date)
    siwei_branch pushes to siwei_branch (fast-forwardable)