git add
.There is a hidden subdirectory, .git
that is created with git init
. When you add a file to the staging area, git creates or updates the file information in .git/index
. This includes checksums, timestamps, and filenames.
git compresses the file and stores the compressed file as an object (blob) in .git/objects/
. If it is a modified file that is already tracked, git stores the modifications as a new object so that there are versions of each iteration.
git commit
) is stored in .git/objects/
. A commit is also called a snapshot.# view config with CLI
git config --list
user.name=linuxuser
user.email=linuxuser@example.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
# view global config
cat /home/linuxuser/.gitconfig
[user]
name = linuxuser
email = linuxuser@example.com
# view local config
cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
# .git contents
ls .git
branches config HEAD index logs packed-refs
COMMIT_EDITMSG description hooks info objects refs
# view last commit msg
cat .git/COMMIT_EDITMSG
linux file in git