git-count-objects
Verify Git repository integrity and disk usage
TLDR
Count all objects and display the total disk usage
Display a count of all objects and their total disk usage, displaying sizes in human-readable units
Display more verbose information
Display more verbose information, displaying sizes in human-readable units
SYNOPSIS
git count-objects [-v] [-H] [--verbose] [--human-readable] [--disk-usage] [--no-verbose]
PARAMETERS
-v, --verbose
Show size breakdown for each object type.
-H, --human-readable
Print sizes in human readable format.
--disk-usage
Show disk space usage.
--no-verbose
Suppress verbose output. Useful to override `-v` in configuration.
DESCRIPTION
The `git-count-objects` command counts the number of unpacked and packed git objects in a repository. It provides statistics about the sizes of various object types (blobs, trees, commits, tags) and also provides information about the size of the .pack files that store compressed object data. This is useful for understanding the overall size and structure of your git repository and for identifying potential bloat or inefficiencies. The output can be tailored to show object counts, disk space usage, and packfile details. The command is helpful when optimizing git repositories for size and performance, as well as diagnosing issues related to repository corruption or object reachability problems. It does not modify the repository itself; it only provides read-only information.
CAVEATS
The disk space usage reported might differ slightly from actual disk space usage due to file system overhead and block size.
OUTPUT INTERPRETATION
The verbose output (`-v`) shows the count and size of each object type (blob, tree, commit, tag). The disk usage output (`--disk-usage`) shows the amount of disk space consumed by packed and unpacked objects. The human readable format (`-H`) improves output readability.
HISTORY
The `git-count-objects` command has been present in Git since early versions, offering essential insight into repository object organization and consumption. It allows developers to monitor and optimize git repositories. This command allows developers to analyze repository object usage, allowing them to optimize performance.
SEE ALSO
git-fsck(1), git-prune(1), git-repack(1)