0%

Git-远程分支,远程跟踪分支,跟踪分支的区别

git pro 3.5 关于分支存在三种:

  • 远程分支,remote branches
  • 本地分支,local branches
  • 远程跟踪分支,remote-tracking branches

远程分支

远程分支 就是在远程仓库的普通分支,
比如远程仓库上的master,自己在远程仓库创建的分支,以及自己推送到远程仓库上去的在远程仓库上的分支。
当运行 git push (仓库名) 分支名 的命令时,便会在远程仓库创建远程分支。

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

command

如何查看本地跟踪分支对应的远程分支

git branch --help
git branch -vv

-v, -vv, –verbose
When in list mode, show sha1 and commit subject line for each head, along with relationship to upstream branch (if any).
If given twice, print the name of the upstream branch, as well (see also git remote show ).

ref

  1. 远程分支和本地分支的相互创建和跟踪
  2. Git-远程分支,远程跟踪分支,跟踪分支的区别
  3. Git远程操作详解