Git vs Working Directory — what exactly is the difference?
Fortunately, this blog clarifies the main difference between the two most popularly used coding directories.
Without any further ado, let’s dive straight in.
Creator of a Git vs. Working Directory
The working directory is a folder you create to store all your project’s files. In contrast, Git creates the Git directory in the working directory you instructed it to monitor.
A Git directory is a hidden file, whereas, a working directory is not.
Usage of a Git vs. Working Directory
Git directory is for recording the file versions you authorized Git to track. However, you create a working repository to store any file — regardless of it being under version control.
Git creates the Git directory inside a working repository. Hence, a Git directory lives inside a working repository. However, a working directory can live anywhere in a system.
Content of a Git vs. Working Directory
A working directory contains both Tracked and Untracked files. In contrast, the Git directory contains only Tracked files.
- Tracked files are files of which Git knows. That is, any staged — or committed — file is a tracked file.
- Untracked files are every other file that Git does not know. That is, any unstaged — or uncommitted — file is an untracked file.
This Git vs Working directory post highlighted the key differences between the two most popular coding folders.
The gist of it all is that git directories and working directories are important folders that help manage a project’s files. Nonetheless, while a working directory can function without a Git directory, Git directories need working directories. In other words, a Git directory lives and works inside a working repository.
Featured Image: Waterfall umbrella nature by Michael Luenen