// Git Toolbox
.git inspector
The .git folder is your repository's brain. Here is what each part is for, what you can touch, and what it tells about your repo.
Contents of .git
HEADWhere you are: usually “ref: refs/heads/main”. A raw commit hash means detached HEAD.
DestructiveDon't touchLook inside
Safe$ cat .git/HEADconfigThis repository's settings: remotes, branch tracking, local options. Edit it with git config rather than by hand.
CautionCarefullyLook inside
Safe$ git config --local --listdescriptionOnly used by GitWeb. You can ignore it.
SafeYou can touch itindexThe staging area: the exact snapshot of your next commit (binary file).
DestructiveDon't touchLook inside
Safe$ git ls-files --stageobjects/The database: every version of every file (blobs), folder (trees), commit and annotated tag, compressed and named by their hash.
DestructiveDon't touchLook inside
Safe$ git count-objects -vHpack/Objects packed together (.pack + .idx), with deltas between versions. Created by clone, fetch and git gc.
DestructiveDon't touchLook inside
Safe$ git verify-pack -v .git/objects/pack/*.idx | sort -k3 -n | tail -5info/Extra information for the object store (alternates, packs list).
SafeYou can touch ita1//Loose objects: 2 first characters of the hash as folder, the other 38 as file name.
DestructiveDon't touchLook inside
Safe$ git cat-file -p <hash>
refs/Branches, tags and remote branches: small text files that contain a commit hash.
CautionCarefullyLook inside
Safe$ git show-refheads/Your local branches. refs/heads/main contains the hash of main's last commit.
CautionCarefullyLook inside
Safe$ git branch -vtags/Your tags (v1.0.0…).
CautionCarefullyLook inside
Safe$ git tag -nremotes/The last known state of remote branches (origin/main…), updated by fetch.
SafeYou can touch itLook inside
Safe$ git branch -rstashYour stashes.
CautionCarefullyLook inside
Safe$ git stash list
packed-refsMany refs in one file, for speed. A branch can be here instead of refs/heads/.
CautionCarefullyLook inside
Safe$ cat .git/packed-refslogs/The reflog: every position HEAD and each branch had. This is what saves you after a bad reset.
CautionCarefullyLearn more →Look inside
Safe$ git refloghooks/Scripts run by Git at key moments (pre-commit, pre-push…). Files ending in .sample are inactive examples.
SafeYou can touch itLearn more →info/info/exclude: a personal .gitignore that is never committed.
SafeYou can touch itLook inside
Safe$ cat .git/info/excludeCOMMIT_EDITMSGThe message of your last commit, as typed in the editor.
SafeYou can touch itFETCH_HEADtemporaryWhat the last fetch brought back.
SafeYou can touch itLook inside
Safe$ cat .git/FETCH_HEADORIG_HEADtemporaryWhere HEAD was before the last dangerous operation (merge, rebase, reset).
SafeYou can touch itLook inside
Safe$ git log -1 ORIG_HEADMERGE_HEADtemporaryMERGE_MSGtemporaryThe prepared message of the merge commit.
SafeYou can touch itrebase-merge/temporaryrebase-apply/temporaryState of a git am or an old-style rebase.
DestructiveDon't touchCHERRY_PICK_HEADtemporaryThe commit being cherry-picked.
DestructiveDon't touchREVERT_HEADtemporaryThe commit being reverted.
DestructiveDon't touchBISECT_LOGtemporarySteps of a git bisect.
SafeYou can touch itsequencer/temporaryState of a cherry-pick or revert of several commits.
DestructiveDon't touchindex.locktemporaryshallowtemporaryCommits where the history stops (clone --depth).
CautionCarefullymodules/The repositories of your submodules.
CautionCarefullyLook inside
Safe$ git submodule statusworktrees/Extra working folders created with git worktree add.
CautionCarefullyLook inside
Safe$ git worktree listlfs/Git LFS: local copies of large files.
CautionCarefullyLook inside
Safe$ git lfs ls-filesAUTO_MERGEtemporaryRecent Git (2.42+): the tree Git merged automatically during the last merge, conflicts included. Handy to see what you changed while resolving.
SafeYou can touch itLook inside
Safe$ git diff AUTO_MERGEgc.logtemporaryErrors of the last automatic git gc.
SafeYou can touch it
The 4 kinds of objects
- blob
- the content of a file (not its name)
- tree
- a folder: names → blobs and other trees
- commit
- a tree + parent(s) + author + message
- tag
- an annotated tag: a name and a message on a commit
See any object: git cat-file -p 1a2b3c4
What's in yours?
Paste the listing of your .git folder: the inspector tells you what is going on (merge in progress, lock left behind…).
$ ls -la .git
$ Get-ChildItem -Force .git