zmk-config git 分支是非父目录中新货运项目的头部

问题描述 投票:0回答:1

问题:

我在

~/zmk-config
中有一个 zmk-config 目录,它也是一个 git 存储库。这个存储库似乎是我创建的每个新 git 存储库的头部,即使在不同/非子目录中也是如此。

例如:

~
-> pwd
/Users/uname

-> cd ~/zmk-config
zmk-config on branch zmk-config

-> git show 
commit a1... (HEAD -> zmk-config)
    
    trying to change head
...

-> cd ~/rust
/Users/uname/rust

-> cargo new vcs_test
building...

-> cd vcs_test
vcs_test on branch zmk-config
v1.78.0 -> 

我期待的是:

-> cd vcs_test
vcs_test on branch vcs_test

我尝试从两个存储库中删除

.git
并重新初始化,但在使用 Cargo 构建新的 Rust 项目时仍然遇到错误。

我在两个存储库中都尝试过

git reset
,但这也没有解决问题。

使用

cargo new vcs_test --vcs none
并不能解决问题。

我是新手/正在学习 Rust 和 Cargo,我对 git 知之甚少。

我正在使用 starship 终端模拟器,我的编辑器是带有 rust-analyzer LSP 的 helix。

感谢您提前提供任何提示。我不知道从哪里开始解决这个问题。

更新:来自目录

~/rust/vcs_test

v1.78.0 -> git config --list --show-origin
file:/opt/homebrew/etc/gitconfig        credential.helper=osxkeychain
file:/Users/james/.gitconfig      user.name=james
file:/Users/james/.gitconfig      [email protected]
file:/Users/james/.gitconfig      init.defaultbranch=zmk-config
file:.git/config        core.bare=false
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=true
file:.git/config        core.ignorecase=true
file:.git/config        core.precomposeunicode=true
file:.git/config        core.logallrefupdates=true

这表明

init.defaultbranch=zmk-config
目录是
zmk-config
。有人有什么建议可以改变这种行为吗?

git rust cargo helix starship
1个回答
0
投票

修复:

-> git config init.defaultBrach master

-> cd ~/rust

~/rust
-> cargo new vcs_test
Building...

-> cd vcs_test

vcs on master
v1.78.0 -> git config --list --show-origin
... init.defaultbranch=master
© www.soinside.com 2019 - 2024. All rights reserved.