banner



how to change directory in git bash

Your Question is :

My default git folder is C:\Users\username.git

But I want to go into c:/project

What command do I need to get into that?

Since you have asked primarily about gitbash which is Linux based (Terminal), there are differences in commands when compared with Command Prompt of Windows. We'll discuss gitbash (Terminal) commands only.

1.First of all we must understand that command line(In Windows) and Terminal(In Mac) always points to some folder on storage Drives .

To check towards what directory it is pointing to at any given time. You need to type the command: pwd "an acronym for 'Print Working Directory' ".

pwd command in Linux

  1. There is a command ls which gives us information about the folders and files in a particular directory. This is quite a handy command and often used to know about the file structure. In my answer I will make use of this also.

enter image description here

  1. To traverse along the folder tree we make use of yet another very important command know as cd which stands for change directory. And your question has the answer within this cd command only.

Here are some of the ways to traverse along the folder tree:

3a) cd command let's us traverse to child directory. Kindly check the snapshot. Going to child directory

3b) Now to traverse back into the parent directory, we make use of cd .. command: Please check the Image below: enter image description here

By Using the above two steps we can easily solve your Query:

A) Currently you are in : C:\Users\username.git

So, doing cd .. will point the Terminal towards Users folder.

enter image description here

B) Again Typing cd .. will make Terminal to point towards C Drive.

enter image description here

C) Now doing ls at this point will let you know about all the folders and files in C drive.

Check if there is a project folder, Then simply for the last time type the command:

cd project

And Walla you are have traveled so far to reach to your destination. Congratulations.

enter image description here

Note: If the project folder is not created with C drive, simply write the command mkdir project and it will be created. Then follow the above steps to play around.

4) There is one more straight forward quick solution to your problem in particular:

Wherever the terminal is pointing. Simply write the command:

4a) cd / It will point to default root folder.

Then type the command : cd /c/ to point towards c directory. Then simply go to child directory, which in your case is project directory by typing:

cd project

enter image description here

And you are good to go: ENJOY :)

how to change directory in git bash

Source: https://stackoverflow.com/questions/8961334/how-to-change-folder-with-git-bash

Posted by: kasparyoulty1963.blogspot.com

0 Response to "how to change directory in git bash"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel