Git Bash is a program that offers Unix-based shell utilities and experiences for Git command line operations for the Windows OS. For Windows users, Git Bash simulates the Git command line interface used in Unix. When people initially install Git for Windows, the majority of Windows users also download Git Bash.
How to change a directory in Git Bash
Here's how to can change the directory or folder you are in, in git bash.
- The first step is to check which directory you are currently in. The way to do this is by using the command:
pwd stands for Print Working Directory and will print the current directory you are in onto your terminal. Once you execute this command, you will be able to see the path of your current Git Bash directory, like so:
2. The next step is to change the current directory to your desired directory or folder. To do this, simply type
cd followed by the path to the directory you want to switch to in your command prompt or terminal.
- For example, if you want to change the directory to the downloads folder which lives in your current location, then you can type
cd downloadsto change into that folder. So to change the current directory or folder, type
cdfollowed by the path to the folder/directory you want to change to.
$ cd downloads
$ cd "C:\My downloads"
- If you want to change to a directory that does not live in your current file path, you can specify exactly which file path you want git bash to follow. For example, if you are currently in
C:\Users\username\desktopand want to transfer into
C:/webprojectsthen you can use the following command:
$ cd c/webprojects
You can use the
pwd command to show the current directory you are in, and based on your location, use the
cd command to change to the directory or folder of your choice. That's all folks!