T
The Daily Insight

How do I switch drives in Git bash

Author

Olivia Owen

Published Feb 12, 2026

In order to navigate to a different drive/directory you can do it in convenient way (instead of typing cd /e/Study/Codes), just type in cd[Space], and drag-and-drop your directory Codes with your mouse to git bash, hit [Enter].

How do I switch between drives in Git bash?

In order to navigate to a different drive/directory you can do it in convenient way (instead of typing cd /e/Study/Codes), just type in cd[Space], and drag-and-drop your directory Codes with your mouse to git bash, hit [Enter].

How do I move to another drive in CMD?

2. How to change the drive in Command Prompt (CMD) To access another drive, type the drive’s letter, followed by “:”. For instance, if you wanted to change the drive from “C:” to “D:”, you should type “d:” and then press Enter on your keyboard.

How do I get to the C drive in Git bash?

Git bash terminal automatically opens with the intended directory. For example, go to your project folder. While in the folder, right click and select the option and ‘Git bash’. It will open automatically with /c/project .

How do I put CD in C drive?

Typing cd \ will move you from any folder on the drive to the root folder of that drive. If you’re in C:\Windows\System32 , type cd \ and press Enter to move to C:\ . If the path has spaces, enclose it in double-quotes.

How do I navigate to a folder in bash?

  1. To navigate into the root directory, use “cd /”
  2. To navigate to your home directory, use “cd” or “cd ~”
  3. To navigate up one directory level, use “cd ..”
  4. To navigate to the previous directory (or back), use “cd -“

How do I change the home directory in git bash?

  1. Open up Git Bash.
  2. Run vim ~/.bashrc.
  3. Press i in order to insert characters.
  4. Type cd C:/path/to/folder; (make sure it’s on its own line)
  5. Press esc to exit the insert mode.
  6. Press :wq or ZZ to save and exit vim.

How do you change drives in PowerShell?

As I am sure you probably know, PowerShell allows you to switch between file system drives by simply entering the drive letter followed by a colon. For example, you would enter C: to switch to the C: drive.

How do I change the default directory in git bash?

  1. Type git bash in search.
  2. Right click on it and choose open file location.
  3. Right click on it and choose properties.
  4. At target remove –cd-to-home from “C:\Program Files\Git\git-bash.exe” –cd-to-home.
  5. At start in put the path of the directory you want it to start at for example Start in: C:\xampp\htdocs.
How do I change C drive to E drive in command prompt?

For example if you are working in C: drive and if you want to switch to E: drive just type ‘E:’ at command prompt and press ‘Enter‘. If you want to switch and also move to some particular directory in the new drive then you can use ‘cd’ command with /D switch.

Article first time published on

Can't CD into another drive?

How to fix: When you need to change to another drive, you don’t need to use CD command and it won’t work, you can just type the drive letter followed by a colon, e.g. D:. If you want to change the directory and folder path at the same time, you can use add the “/d” switch after CD command, e.g. cd /d d:\PS.

What is Pushd command?

The pushd command saves the current working directory in memory so it can be returned to at any time, pushd moves to the parent directory. The popd command returns to the path at the top of the directory stack. This directory stack is accessed by the command dirs in Unix or Get-Location -stack in Windows PowerShell.

How do I change the directory in Windows?

Open the Command prompt, type in cd followed by the directory you want to move into, and hit Enter. Change the Windows directory by entering the drive name followed by : in the Command prompt, and hit Enter. In the Command prompt, type cd and drag the folder you want to move into from the GUI.

How do I change my home in bash?

The Home ( ~ ) directory in Git Bash can be changed by setting the user-level %HOME% environment variable in Windows. This is quite safe as the %HOME% environment variable is not normally set for Windows applications, so creating it shouldn’t affect anything else.

Where is git bash home directory?

Find it by typing cd / then pwd -W . Alternatively, from the start menu, right click on the Git Bash icon and select open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git , the mingw64 in this directory is your root.

How do I navigate in bash?

  1. Ctrl+a or the Home key go to the beginning of the line, and Ctrl+e or the End key go to the end. …
  2. Alt+b moves back one word, and Alt+f moves forward one word. …
  3. Ctrl+l or typing the clear command clears the screen.

How do I go back in terminal?

The .. means “the parent directory” of your current directory, so you can use cd .. to go back (or up) one directory. cd ~ (the tilde). The ~ means the home directory, so this command will always change back to your home directory (the default directory in which the Terminal opens).

How do I change my directory?

  1. To change to your home directory, type the following: cd.
  2. To change to the /usr/include directory, type the following: cd /usr/include.
  3. To go down one level of the directory tree to the sys directory, type the following: cd sys.

How do I change the drive path in PowerShell?

  1. Press the “Windows + X” key, and click on the “Windows PowerShell (Admin)” option.
  2. Type “diskpart” and press enter key.
  3. Type “list volume” and press the enter button.
  4. Type “select volume <number>” and press enter key. …
  5. Type “assign letter = <Drive Letter>” and press enter key.

How do I change the drive location in PowerShell?

You can also change directory in PowerShell to a specified path. To change directory, enter Set-Location followed by the Path parameter, then the full path you want to change directory to. If the new directory path has spaces, enclose the path in a double-quote (“”).

How do I change directory in PowerShell?

Using command-line utilities The Windows PowerShell prompt opens by default at the root of your user folder. Change to the root of C:\ by entering cd c:\ inside the Windows PowerShell prompt.

How do I switch disk drives?

Changing a drive letter in Windows 10 is relatively easy, as follows. Right-click the Windows 10 Menu button and select Disk Management to display a list of all available hard drives. Right-click the specific hard drive letter you want to change, and select Change Drive Letter and Paths.

How do I open C drive in command prompt?

  1. You can press Windows + R, type cmd, and hit Enter to open Command Prompt window. …
  2. After the Command Prompt opens, you can type the drive letter of the desired drive, followed by a colon, e.g. C:, D:, and hit Enter.

Why does Sudo CD not work?

There is no /usr/bin/cd . It does not exist anywhere. The whole concept of working directory is a shell-internal thing. Therefore, outside the shell, and in programs like sudo , it has no meaning, since sudo only inherits it from the shell, but only for as long as it runs, which is until the command finishes.

How do I change drives in Linux?

  1. To return to the home directory immediately, use cd ~ OR cd.
  2. To change into the root directory of Linux file system, use cd / .
  3. To go into the root user directory, run cd /root/ as root user.
  4. To navigate up one directory level up, use cd ..

What is Pushd and Popd in bash?

Both pushd and popd are shell builtin commands. The pushd command is used to save the current directory into a stack and move to a new directory. Furthermore, popd can be used to return back to the previous directory that is on top of the stack.

What does pushd do in bash?

pushd is a shell built-in command which allows us to easily manipulate the directory stack. This appends a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the present working directory.

What is git pushd?

The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo. It’s the counterpart to git fetch , but whereas fetching imports commits to local branches, pushing exports commits to remote branches.

How do I change directory in VS terminal?

The hotkey for that depends on your operating system, in my case, on macOS, it’s ⌃ + ` , on Windows I think it’s ctrl + j . If you want to open at the current file’s directory you can install an extension like Terminal Here. You can change the shortcuts/hotkeys for many actions on Code.

How do I change drive letters in command prompt Windows 10?

  1. Open an elevated command prompt.
  2. Type diskpart .
  3. Type list volume to see all drives and their partitions.
  4. Look at the ### column in the output. You need to use its value with the command select volume NUMBER . …
  5. Type the command assign letter=X to change the drive letter.

How do I edit the path in Windows 10?

  1. Open the Start Search, type in “env”, and choose “Edit the system environment variables”:
  2. Click the “Environment Variables…” button.
  3. Under the “System Variables” section (the lower half), find the row with “Path” in the first column, and click edit.