Rank files by how often they changed in Git history
Build a paste-ready command, then review its compatibility and effects before running it.
git log --pretty=format: --name-only --diff-filter=ACMRT | sed '/^$/d' | sort | uniq -c | sort -nr | head -<count>Complete required fields to copy the generated command.
read-onlyno known side effects Compatibility
Linux + macOSVerified for Linux, macOS using bash, zsh syntax.
Operational knowledgereview due 2027-01-19
Requirementsgitgit must be installed and available on PATH.
Version supportgit Current supported releasesVerified for linux, macos using bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signals219 src/api/client.tsRepresentative successful output; values vary with the selected target and system state.
Known errorsgit: command not foundgit is missing or is not available on PATH.
Verifygit log --pretty=format: --name-only --diff-filter=ACMRT | sed '/^$/d' | sort | uniq -c | sort -nr | head -{{count}}The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01gitCommandRuns the git stage of this one-liner.
02logArgumentPasses log to git.
03--pretty=format:OptionConfigures git with the --pretty=format: option.
04--name-onlyOptionConfigures git with the --name-only option.
05--diff-filter=ACMRTOptionConfigures git with the --diff-filter=ACMRT option.
06|PipelinePasses the output on the left to the command on the right.
07sedCommandRuns the sed stage of this one-liner.
08'/^$/d'ArgumentPasses '/^$/d' to sed.
09|PipelinePasses the output on the left to the command on the right.
10sortCommandRuns the sort stage of this one-liner.
11|PipelinePasses the output on the left to the command on the right.
12uniqCommandRuns the uniq stage of this one-liner.
13-cOptionConfigures uniq with the -c option.
14|PipelinePasses the output on the left to the command on the right.
15sortCommandRuns the sort stage of this one-liner.
16-nrOptionConfigures sort with the -nr option.
17|PipelinePasses the output on the left to the command on the right.
18headCommandRuns the head stage of this one-liner.
19-<count>OptionConfigures head with the -<count> option.
This advanced community-curated one-liner combines several stages. Review every option and placeholder before running it.
Example input
git log --pretty=format: --name-only --diff-filter=ACMRT | sed '/^$/d' | sort | uniq -c | sort -nr | head -3
Example output
219 src/api/client.ts
184 package-lock.json
117 src/app.ts
Illustrative output — exact values vary by system and data.
Official sources