0

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 

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. Is there any other command in git that takes me to "C:\Users\J P\Dropbox\Git Bash". "C:\Users\J P\Dropbox\Git Bash" is also the directory I start git from.
No. How would git know which repo's root to change to? You could set up a DOS alias I suppose: superuser.com/questions/560519/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.