2

How do I change my current directory location from /c/users/XYZ to D:college stuff in git bash

Hitesh
  • 21
  • 1
  • 2

3 Answers3

3

Git bash stores the system Drive as folder, so say for example if in your system there is 3 drives namely C, D and E Drive. so what git bash will do is, it will create directly like structure, so say for example, currently, you are in

C:/users/hitesh/gitRepo

and You want to navigate to

D:/Repos/gitRepoFirst

then you can simply do like bellow

cd D:

Then, this will make you move in into D Drive and then you can navigate as usual, but there is pretty handy way to directly get into your destination folder(D:/Repos/gitRepoFirst in this example), you can do like bellow

cd D:/Repos/gitRepoFirst and press enter

Cheersssssssss!!!!!!!!

KAmit
  • 337
  • 3
  • 13
2

You can change it by typing the drive letter and directory name in your bash and hit enter:-

$ cd /D/folder_name

and then you will switch to that drive and directory. Here D is the Drive letter.

Shashishekhar Hasabnis
  • 1,636
  • 1
  • 15
  • 36
0

3 years later I found that post.. but did it work for you? Are you sure you are in Git Bash and not Git CMD? the above solutions does not work in Git CMD though.. there is a good explanation in another stckoverflow post here:

Command prompt won't change directory to another drive

fast answer from this post:

cd /d d:\Docs\Java

CHDIR [/D] [drive:][path] CHDIR [..] CD [/D] [drive:][path] CD [..]

.. Specifies that you want to change to the parent directory.