我有几个github存储库。当我克隆某个存储库时,会自动跟踪随后的分支结帐。但是对于其他很少的回购,它不会发生。
我的git版本
root@e7440:~/dev_env/wq$ git --version
git version 1.9.1
自动跟踪git clone
root@e7440:~/dev_env$ git clone git@github.com:XYZ/lb.git lb
Cloning into 'lb'...
remote: Counting objects: 6433, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 6433 (delta 0), reused 0 (delta 0), pack-reused 6431
Receiving objects: 100% (6433/6433), 7.24 MiB | 10.79 MiB/s, done.
Resolving deltas: 100% (4636/4636), done.
Checking connectivity... done.
root@e7440:~/dev_env$ cd lb
检查开发分支
root@e7440:~/dev_env/lb$ git checkout develop
Branch develop set up to track remote branch develop from origin.
Switched to a new branch 'develop'
已签出的分支“开发”自动跟踪
root@e7440:~/dev_env/lb$ git branch
* develop
master
lb repo上的远程分支
root@e7440:~/dev_env/lb$ git branch -r
origin/HEAD -> origin/master
origin/develop
origin/master
origin/production
origin/stage
同一帐户中的另一个存储库不会在签出分支时自动跟踪
root@e7440:~/dev_env$ git clone --no-single-branch git@github.com:XYZ/wq.git wq
Cloning into 'wq'...
remote: Counting objects: 13552, done.
remote: Compressing objects: 100% (3397/3397), done.
remote: Total 13552 (delta 348), reused 0 (delta 0), pack-reused 10155
Receiving objects: 100% (13552/13552), 15.95 MiB | 10.83 MiB/s, done.
Resolving deltas: 100% (5481/5481), done.
Checking connectivity... done.
root@e7440:~/dev_env/lb$ cd wq
在'wq'remo
上查看开发分支root@e7440:~/dev_env/wq$ git checkout develop
root@e7440:~/dev_env/wq$ git branch
* master
'wq'存储库的所有远程分支
root@e7440:~/dev_env/wq$ git branch -r
origin/HEAD -> origin/master
origin/develop
origin/feature-gulpversion
origin/feature-lb-groups
origin/feature-maps
origin/feature-pic
origin/feature-redesign
origin/feature-timerz
origin/master
origin/production
origin/stage
我不确定为什么会这样。当本地分支名称与远程分支名称匹配时,如何确保自动跟踪远程分支。
受影响的仓库的.git / config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:XYZ/wq.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
输出git flow init命令
$:~/dev_env$ git clone --no-single-branch git@github.com:XYZ/wq.git wq
Cloning into 'wq'...
remote: Counting objects: 13567, done.
remote: Compressing objects: 100% (3412/3412), done.
remote: Total 13567 (delta 353), reused 0 (delta 0), pack-reused 10155
Receiving objects: 100% (13567/13567), 16.05 MiB | 559.00 KiB/s, done.
Resolving deltas: 100% (5486/5486), done.
Checking connectivity... done.
$:~/dev_env$ cd wq
$:~/dev_env/wq$ git flow init -f
Which branch should be used for bringing forth production releases?
- master
Branch name for production releases: [master] production
Which branch should be used for integration of the "next release"?
- master
Branch name for "next release" development: [master] develop
Fatal: Local branch 'develop' does not exist.
它出于git flow而出错。
实现了一件事,这个分支是来自另一个分支的分支分支