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
.gitfolder contains all the files and folders that make up the Git repository. -
The
refsfolder contains the human-readable labels that point to the commits. -
The
hooksfolder contains scripts that can be executed at different stages of the Git workflow. -
The
objectsfolder contains the actual data stored in the repository, including commits, trees, and blobs. -
The
HEADfile points to the current branch or commit. -
The
configfile contains the configuration settings for the repository. -
The
indexfile 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-filescommand can be used to list all files in the repository. -
The
git logcommand can be used to view the commit history. -
The
git cat-filecommand can be used to view the contents of a file in the repository. -
The
git add,git commit, andgit pushcommands can be used to create and manage commits. -
The
git resetcommand can be used to reset the index and the HEAD to a specific commit. -
The
git cherry-pickcommand can be used to apply a specific commit to the current branch. -
The
git stashcommand can be used to temporarily store changes. -
The
git log --graphcommand can be used to visualize the commit history. -
The
git log --one-linecommand can be used to view the commit history in a one-line format. -
The
git ls-files -dcommand can be used to list all files in the repository that are not under version control. -
The
git gccommand can be used to garbage collect objects in the repository.