如何更改 "cd \" 在 git 中的目录?

How can I change the directory that "cd \" goes to in git?

当我输入 cd \ 时 git 进入了一个与我想要的不同的目录。

我如何更改它以便 cd \ 将我带到

C:\Users\J P\Dropbox\Git Bash

cd \ 将您带到当前驱动器的根目录。这是 Windows 的函数,而不是 git.

的函数

如果你想改变它,你必须使用 Windows 来做,而不是 git

一种方法可能是使用绑定到 C:\Users\J P\Dropbox\Git Bash 的单独驱动器号(例如 Z:)。在 DOS 中 SUBST command did that. It appears to work with XP, and here's 一种使其持久化的方法。最简单的似乎是:

 net use z: "\computerName\c$\Users\J P\Dropbox\Git Bash" /persistent:yes

然后,如果您更改为驱动器 z:cd \ 将带您到 z: 的根目录,这将是正确的位置。

可能有 different/better Windows 方法可以做到这一点。