Change Directory With Git Bash

This tutorial demonstrates changing the directory in git bash using the cd command.

Change Directory With Git Bash

Before changing the directory, you need to know your current working directory. To do this, you use the pwd command. This command stands for print working directory.

$ pwd

The output of the code above shows that we are in /c/Users/0x30 directory.

change directory with git bash

To move from the current working directory to another directory, we use the cd command. The cd command stands for change directory. It takes the path of the directory where we want to move to as the argument.

In the case below, we move from the current working directory to /c/example/ using cd.

$ cd /c/example/

To confirm that we have moved to the new directory, check the current working directory using the pwd command.

$ pwd

From the output below, it shows that we have successfully changed directories in git bash.

change directory with git bash

Contribute
DelftStack is a collective effort contributed by software geeks like you. If you like the article and would like to contribute to DelftStack by writing paid articles, you can check the write for us page.

Related Article - Bash Directory

  • Remove Directory in Bash Terminal
  • Related Article - Bash Git