user1283776
user1283776

Reputation: 21764

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

When I enter cd \ git goes into a different directory than I would like to.

How can I change it so that cd \ takes me to

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

Upvotes: 0

Views: 77

Answers (1)

abligh
abligh

Reputation: 25129

cd \ takes you to the root directory of the current drive. That is a function of Windows, not a function of git.

If you want to change it, you'll have to use Windows to do that, not git.

One route might be to use a separate drive letter (e.g. Z:) bound to C:\Users\J P\Dropbox\Git Bash. In DOS the SUBST command did that. It appears to work with XP, and here's a way to make it persistent. The easiest appears to be:

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

Then if you change to drive z:, cd \ will take you to z:'s root, which will be the right place.

There's probably a different/better Windows way to do that.

Upvotes: 3

Related Questions