How to change folder with git bash?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
In Git Bash, changing folders works the same way it does in a normal Unix shell: you use the cd command. The only part that sometimes confuses Windows users is the path format, because Git Bash translates Windows drives into Unix-style paths such as /c/Users/markqian.
Basic cd Usage
To move into another folder, type cd followed by the target path:
You can check where you are with pwd:
And list the contents of the current folder with ls:
Those three commands are usually enough for everyday navigation.
Windows Paths in Git Bash
Git Bash does not usually want raw Windows path syntax like C:\Users\markqian. Instead, it maps drives like this:
- '
C:\becomes/c/' - '
D:\becomes/d/'
So if Explorer shows:
the Git Bash path is:
Once you get used to that conversion, navigation becomes straightforward.
Relative Paths
You do not always need the full absolute path. If the target folder is inside your current folder, a relative path is shorter:
To go up one folder:
To go up two levels:
This is especially useful when moving around inside a repository.
Folders with Spaces
If the folder name contains spaces, wrap the path in quotes:
You can also escape spaces with backslashes:
Quotes are usually easier to read, especially for beginners.
Useful Navigation Shortcuts
Git Bash supports a few common shell shortcuts:
- '
cd ~goes to your home directory' - '
cd -returns to the previous directory' - pressing
Tabautocompletes folder names
Example:
That last command is handy when switching back and forth between two folders.
Finding the Path You Actually Need
If you are not sure what to type after cd, a practical trick is to navigate to the folder in Windows Explorer first and then translate the path into Git Bash style. For example, if Explorer shows D:\work\demo-repo, the matching Git Bash command is:
This is often easier for beginners than trying to guess the shell path from memory.
Typical Git Workflow Example
Here is a short real-world session:
The important point is that Git commands do not change folders for you. You must cd into the repository before commands like git status, git add, or git pull operate on the project you expect.
Common Pitfalls
The most common mistake is using Windows backslash paths directly. In Git Bash, /c/Users/... is usually safer than C:\Users\....
Another frequent issue is forgetting quotes around paths with spaces. That makes Bash interpret each word as a separate argument.
Some users also expect Git Bash to change into the repository automatically when they open the terminal. It usually starts in the home directory instead, so checking with pwd avoids confusion.
Finally, cd only changes location in the current shell session. It does not move files and it does not affect Windows Explorer.
Summary
- Use
cdto change folders in Git Bash. - Git Bash maps Windows drives like
C:\to paths such as/c/. - Use relative paths like
cd ..when moving around nearby folders. - Quote paths that contain spaces.
- Check your current location with
pwdbefore running Git commands.

