Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the startup directory in Git Bash?

What is the command to set startup directory in Git Bash?

When I start Git Bash, the startup directory is Bitbust directory in C drive, so I must change the working directory with cd command.

But I think it is an unnecessary process. I want the startup directory to be my working directory where Git Bash is started.

like image 231
Author Avatar asked Dec 04 '18 05:12

Author


2 Answers

Right click on the shortcut, and select properties. Navigate to the "shortcut" tab.

There are two things you need to change here. First, by default, the Target field will end in --cd-to-home - remove it. Once you've done that, you can edit the Start in field and give it any directory you want.

E.g., this is how the shortcut looks on my machine:

enter image description here

After editing, you'll have:

enter image description here

You could also, of course, create multiple Git Bash shortcuts to start in each directory you're interested in.

like image 83
Mureinik Avatar answered Oct 08 '22 12:10

Mureinik


Here is a quick fix;

Instead of opening git and navigating to the folder you want by using cd /long/path/to/your/files do as below;

In Windows 10,

  • Go to any folder you like.
  • Right click
  • Click Open Git here
  • Then Git will automatically open in the selected folder.

Here is how it looks when you right click

like image 37
dataatomic Avatar answered Oct 08 '22 11:10

dataatomic