We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
The Definitive Deep Dive into the .git Folder | Rob Richardson
Get a detailed look at the inner workings of the .git folder, including its files and folders, and learn how to master Git commands like ls-files, log, cat-file, add, commit, push, reset, cherry-pick, stash, and more.
- Git is a double-entry bookkeeping system that keeps track of all changes.
-
The
.git
folder contains all the files and folders that make up the Git repository. -
The
refs
folder contains the human-readable labels that point to the commits. -
The
hooks
folder contains scripts that can be executed at different stages of the Git workflow. -
The
objects
folder contains the actual data stored in the repository, including commits, trees, and blobs. -
The
HEAD
file points to the current branch or commit. -
The
config
file contains the configuration settings for the repository. -
The
index
file keeps track of the changes made to the repository. - Git can be configured to run scripts at different stages of the workflow using hooks.
-
The
git ls-files
command can be used to list all files in the repository. -
The
git log
command can be used to view the commit history. -
The
git cat-file
command can be used to view the contents of a file in the repository. -
The
git add
,git commit
, andgit push
commands can be used to create and manage commits. -
The
git reset
command can be used to reset the index and the HEAD to a specific commit. -
The
git cherry-pick
command can be used to apply a specific commit to the current branch. -
The
git stash
command can be used to temporarily store changes. -
The
git log --graph
command can be used to visualize the commit history. -
The
git log --one-line
command can be used to view the commit history in a one-line format. -
The
git ls-files -d
command can be used to list all files in the repository that are not under version control. -
The
git gc
command can be used to garbage collect objects in the repository.