我已经在本地创建了一个代码库,并将所有更改推送到了Github。 后来我创建了一个名为“v2”的新分支(“git branch v2”),并进行了一些修改,然后也将该分支推送到了Github上。 后来当我执行命令“git remote show origin”时,我得到了以下输出。
* remote origin
Fetch URL: https://github.com/mayuran19/se24_P03.git
Push URL: https://github.com/mayuran19/se24_P03.git
HEAD branch: master
Remote branches:
master tracked
v2 tracked
Local branch configured for 'git pull':
master merges with remote master
Local refs configured for 'git push':
master pushes to master (local out of date)
v2 pushes to v2 (local out of date)
但是当我执行命令 "git branch -vv" 时,它显示分支 "v2" 不是跟踪分支。
master bad4ed9 [origin/master] Correct name
* v2 6ec46b0 Data files
我的问题是,为什么分支v2尽管远程分支在Github上可用,我可以拉取和推送此分支,但它没有显示为跟踪分支?
命令"git branch -a"的输出如下:
master
* v2
remotes/origin/master
remotes/origin/v2
但没有显示本地分支和远程分支之间的映射关系。
git push
时,git不会为新的本地分支设置跟踪? - Artyom-u
标志,git push
将会设置上游分支,正如我在注释中所提到的。这个功能是在Git 1.7.0中新增的。 - torek