为什么 [branch "development"] 不存在于 .git/config 中?
Why is [branch "development"] not present in .git/config?
我的问题是为什么下面的 .git/config
文件没有 [branch "development"]
部分;添加这样的部分有什么作用?以及如何测试真正发生的事情,例如使用虚拟文件?
详情如下:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = test@test:test.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
我有主分支和开发分支。正如预期的那样,当我 git checkout development
时,我可以在开发中进行不在 master 中的更改。稍后,我可以将 development 合并回 master。
我很困惑为什么.git/config
中没有配置开发分支。
我的猜测是您没有 upstream/remote 与 development
关联,因此不需要配置条目。如果你用 git push origin development -u
将它推送到 origin,你应该会在你的配置中看到它。
I'm confused as to why the development branch is not configured in .git/config
.
您根本没有给定分支的上游或跟踪定义。
为什么没有跟踪分支或上游?
它实际上取决于您的 git 版本,因为它已在 git 2.0 版中更新。
如果你有 clones/created 旧版本 git (<2.0) 的回购协议,这就是你没有 upstream/tracking 分支的原因。
您可以在这里阅读所有相关信息:
https://git.kernel.org/cgit/git/git.git/tree/Documentation/RelNotes/2.0.0.txt
When git push [$there]
does not say what to push, we have used the
traditional matching
semantics so far (all your branches were sent
to the remote as long as there already are branches of the same name
over there). In Git 2.0, the default is now the simple
semantics,
which pushes:
only the current branch to the branch with the same name, and only
when the current branch is set to integrate with that remote
branch, if you are pushing to the same remote as you fetch from; or
only the current branch to the branch with the same name, if you
are pushing to a remote that is not where you usually fetch from.
You can use the configuration variable push.default
to change
this. If you are an old-timer who wants to keep using the
matching
semantics, you can set the variable to matching
, for
example. Read the documentation for other possibilities.
我的问题是为什么下面的 .git/config
文件没有 [branch "development"]
部分;添加这样的部分有什么作用?以及如何测试真正发生的事情,例如使用虚拟文件?
详情如下:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = test@test:test.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
我有主分支和开发分支。正如预期的那样,当我 git checkout development
时,我可以在开发中进行不在 master 中的更改。稍后,我可以将 development 合并回 master。
我很困惑为什么.git/config
中没有配置开发分支。
我的猜测是您没有 upstream/remote 与 development
关联,因此不需要配置条目。如果你用 git push origin development -u
将它推送到 origin,你应该会在你的配置中看到它。
I'm confused as to why the development branch is not configured in
.git/config
.
您根本没有给定分支的上游或跟踪定义。
为什么没有跟踪分支或上游?
它实际上取决于您的 git 版本,因为它已在 git 2.0 版中更新。
如果你有 clones/created 旧版本 git (<2.0) 的回购协议,这就是你没有 upstream/tracking 分支的原因。
您可以在这里阅读所有相关信息: https://git.kernel.org/cgit/git/git.git/tree/Documentation/RelNotes/2.0.0.txt
When
git push [$there]
does not say what to push, we have used the traditionalmatching
semantics so far (all your branches were sent to the remote as long as there already are branches of the same name over there). In Git 2.0, the default is now thesimple
semantics, which pushes:
only the current branch to the branch with the same name, and only when the current branch is set to integrate with that remote branch, if you are pushing to the same remote as you fetch from; or
only the current branch to the branch with the same name, if you are pushing to a remote that is not where you usually fetch from.
You can use the configuration variable
push.default
to change this. If you are an old-timer who wants to keep using thematching
semantics, you can set the variable tomatching
, for example. Read the documentation for other possibilities.