Git

Where Exactly is the “working directory”?

The Git environment has four states, such as the “working directory”, “staging area”, “local repository”, and the “remote repository”. Users start working on the project in the working directory and make changes to it. When they track changes in the project, those changes are stored in the staging area. After that, you can save their stage changes to the local repository by committing. Finally, push their local changes to the GitHub repository.

This write-up will explain:

What is a Working Directory?

The “Working directory”, also known as the “workspace”, is a folder that users create to store their project files. It is utilized to store or keep any file. It is essentially the user’s project folder.

Where is the Working Directory?

A working directory can be anywhere in the user’s system. Users are permitted to create it anywhere in their system.

How to Create a Working Directory?

To create a working directory/project folder, run the “mkdir <project-name>” command:

$ mkdir demoProject

How to Know the States of Files in Working Directory?

The working directory contains untracked and tracked files. The state of files in the working directory can be seen using the “git status” command.

The below-provided screenshot shows the tracked and untracked files. The “Demo.txt” is the tracked file whereas, the “myFile.txt” is the untracked file:

$ git status


That was all about knowing the working directory in Git.

Conclusion

The “working directory” or “workspace” is a folder that users create to store their project files. It is utilized to store any file. A working directory can be anywhere in the user’s system. It is created using the “mkdir <project-name>” command. Moreover, it contains untracked and tracked files. This write-up explained about the working directory.

About the author

Laiba Younas

I have done bachelors in Computer Science. Being passionate about learning new technologies, I am interested in exploring different programming languages and sharing my experience with the world.