Skip to content

Commit db2dbb5

Browse files
update README
1 parent df72387 commit db2dbb5

File tree

1 file changed

+53
-7
lines changed

1 file changed

+53
-7
lines changed

README.md

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
11
# git-author
22

3-
🔍 **git-author** – Identify Who Owns Your Codebase
3+
🔍 **git-author** – Identify Who Owns Your Codebase
44

5-
`git-author` is a command-line tool designed to answer the age-old question:
5+
`git-author` is a command-line tool designed to answer the age-old question:
66

7-
> _Who wrote this code?!_
7+
> _Who wrote this code?!_
88
9-
Unlike `git blame`, which pinpoints who wrote a specific **line** of code, `git-author` provides a **big-picture view** of authorship. It analyzes your Git repository to determine **who contributed to entire components, directories, or subsystems**, helping teams understand **code ownership at a structural level**.
9+
Unlike `git blame`, which pinpoints who wrote a specific **line** of code, `git-author` provides a **big-picture view** of authorship. It analyzes your Git repository to determine **who contributed to entire components, directories, or subsystems**, helping teams understand **code ownership at a structural level**.
1010

1111
Think of `git-author` as `git blame` for **file trees** rather than individual lines—perfect for tracking ownership, reviewing contributions, and improving collaboration in large codebases. 🚀
1212

13-
## Installation
13+
## Features
14+
15+
- 📊 **Authorship Insights** – Get a summary of contributions per author across the entire repository.
16+
- 🏗 **Flexible Analysis** – Supports different views of authorship with multiple subcommands (`table`, `top`, etc.).
17+
- 🚀 **Fast & Efficient** – Optimized for performance, even in large repositories.
18+
- 🛠 **Seamless Git Integration** – Works alongside existing Git workflows and aliases.
19+
- 💡 **Cross-Platform** – Runs on macOS, Linux, and Windows.
20+
- 📦 **Easy Installation** – Available via package managers (`brew`, AUR) or precompiled binaries.
21+
- 🛠 **Build from Source** – Simple setup for developers who want to customize or contribute.
22+
23+
Let me know if you'd like any refinements! 🚀
24+
25+
## 🚀 Installation
26+
1427
### Precompiled Binaries
28+
1529
See [releases](https://github.com/trinhminhtriet/git-author/releases).
1630

1731
### From Source
32+
1833
Building from source requires that you have Go, Ruby, and the `rake` Ruby gem
1934
installed. Note that these are _only_ required when building from source; you
2035
can download and run one of the binary releases without installing any of these
@@ -28,6 +43,7 @@ $ ./git-author --version
2843
```
2944

3045
## Usage
46+
3147
_(In the following examples, `git-author` is invoked as `git author`. This will work
3248
automatically as long as Git can find `git-author` in your PATH. See the [Git
3349
Alias](#git-alias) section for more details.)_
@@ -36,6 +52,7 @@ Alias](#git-alias) section for more details.)_
3652
authorship in your Git repository.
3753

3854
### The `table` Subcommand
55+
3956
The `table` subcommand is the default subcommand. You can invoke it explicitly
4057
as `git author table` or implicitly just as `git author`.
4158

@@ -63,6 +80,7 @@ author who has made commits in the repository:
6380

6481
You can specify a path to filter the results to only commits that
6582
touched files under the given path:
83+
6684
```
6785
~/repos/cpython$ git author Tools/
6886
┌─────────────────────────────────────────────────────┐
@@ -84,6 +102,7 @@ touched files under the given path:
84102

85103
You can also specify a branch name, tag name, or any "commit-ish" to
86104
filter the results to commits reachable from the specified commit:
105+
87106
```
88107
~/clones/cpython$ git author v3.7.1
89108
┌─────────────────────────────────────────────────────┐
@@ -105,6 +124,7 @@ filter the results to commits reachable from the specified commit:
105124

106125
Revision ranges also work. This shows the commits made after the release
107126
of 3.10.9 up to the release of 3.11.9:
127+
108128
```
109129
~/clones/cpython$ git author v3.10.9..v3.11.9
110130
┌─────────────────────────────────────────────────────┐
@@ -128,11 +148,13 @@ Just like with `git` itself, when there is ambiguity between a path name
128148
and a commit-ish, you can use `--` to clarify the distinction. The
129149
following command will show you contributions to the file or directory
130150
called `foo` even if there is also a branch called `foo` in your repository:
151+
131152
```
132153
$ git author -- foo
133154
```
134155

135156
#### Options
157+
136158
The `-m`, `-c`, `-l`, and `-f` flags allow you to sort the table by different
137159
metrics.
138160

@@ -171,13 +193,15 @@ prints all rows.
171193
Run `git-author table --help` to see additional options for the `table` subcommand.
172194

173195
### The `tree` Subcommand
196+
174197
The `tree` subcommand prints out a file tree showing files in the working tree
175-
just like [tree](https://en.wikipedia.org/wiki/Tree_(command)). Each node in the
198+
just like [tree](<https://en.wikipedia.org/wiki/Tree_(command)>). Each node in the
176199
file tree is annotated with information showing which author contributed the most
177200
to files at or under that path.
178201

179202
Here is an example showing contributions to the Python parser. By default,
180203
contributions will be measured by number of commits:
204+
181205
```
182206
~/repos/cpython$ git author tree Parser/
183207
Parser/.........................Guido van Rossum (182)
@@ -269,6 +293,7 @@ Parser/.........................Guido van Rossum (182)
269293
├── grammar.c...................Guido van Rossum (20)
270294
...
271295
```
296+
272297
(_The above output continues but has been elided for the purposes
273298
of this README._)
274299

@@ -282,6 +307,7 @@ that most of his commits were to files that have since been moved or deleted.
282307
Like with the `table` subcommand, you can specify a "commit-ish". This
283308
next example shows changes to the `Parser/` directory that happened
284309
after the 3.10.9 release up to the 3.11.9 release.
310+
285311
```
286312
~/clones/cpython$ git author tree v3.10.9..v3.11.9 -- Parser/
287313
Parser/.................Pablo Galindo Salgado (52)
@@ -302,6 +328,7 @@ the working tree. This can make `git author tree` useful for visualizing the
302328
changes introduced by a branch.
303329

304330
#### Options
331+
305332
The `tree` subcommand, like the `table` subcommand, supports the `-l`, `-f`,
306333
`-m`, and `-c` flags.
307334

@@ -353,6 +380,7 @@ The `-a` flag has already been mentioned.
353380
Run `git author tree --help` to see all options available for the `tree` subcommand.
354381

355382
### The `hist` Subcommand
383+
356384
The `hist` subcommand prints out a little bar chart / timeline of commit
357385
activity showing the history of contributions to the repository.
358386

@@ -422,11 +450,13 @@ Nov 2024 ┤ # Russell Keith-Magee (1)
422450
Dec 2024 ┤ ###- Russell Keith-Magee (3)
423451
Jan 2025 ┤
424452
```
453+
425454
The printed timeline will begin with the date of the first commit modifying
426455
that path.
427456

428457
You can also filter using a commit-ish. This shows the timeline of contributions
429458
since Python's 3.12 release.
459+
430460
```
431461
~/clones/cpython$ git author hist v3.12.0..
432462
May 2023 ┤ ###--------- Victor Stinner (28)
@@ -453,6 +483,7 @@ Jan 2025 ┤ ##--------- Bénédikt Tran (26)
453483
```
454484

455485
#### Options
486+
456487
The `hist` subcommand supports the `-l` and `-f` flags but not the `-m` or `-c`
457488
flags:
458489

@@ -476,6 +507,7 @@ Run `git author hist --help` for a full listing of the options supported by the
476507
`hist` subcommand.
477508

478509
### Additional Options for Filtering Commits
510+
479511
All of the `git author` subcommands take these additional options that further
480512
filter the commits that get counted.
481513

@@ -490,6 +522,7 @@ inputs. See git-commit(1) for a description of what is possible.
490522

491523
The following example shows the paths edited by Guido van Rossum over the last
492524
eight months:
525+
493526
```
494527
~/repos/cpython$ git author tree -d 1 --since "nine months ago" --author "Guido van Rossum"
495528
./..................Guido van Rossum (11)
@@ -508,16 +541,19 @@ eight months:
508541
```
509542

510543
## Caching
544+
511545
`git author` caches data on a per-repository basis under `XDG_CACHE_HOME` (this is
512546
`~/.cache` if the environment variable is not set).
513547

514548
You can disable caching by setting `GIT_WHO_DISABLE_CACHE=1`.
515549

516550
## Using `git-author` with Docker
551+
517552
You can run `git-author` as a Docker container without installing it on your
518553
system directly. Follow these steps to build and use the Docker image.
519554

520555
### Building the Docker Image
556+
521557
To build the `git-author` Docker image, run the following command from the project root:
522558

523559
```
@@ -527,6 +563,7 @@ docker build -t git-author -f docker/Dockerfile .
527563
This will create a Docker image named `git-author` that you can use to run the tool.
528564

529565
### Running `git-author` via Docker
566+
530567
To use git-author without modifying your Git configuration, you can manually run:
531568

532569
```
@@ -539,6 +576,7 @@ docker run --rm -it -v "$(pwd)":/git -v "$HOME":/root git-author author
539576
- `-v "$HOME:/root"`: Ensures that user-specific configurations (e.g., SSH keys, Git settings) are available inside the container.
540577

541578
### Setting Up a Git Alias
579+
542580
To make it easier to run `git-author`, you can add an alias to your Git
543581
configuration. Add the following lines to your `~/.gitconfig` file:
544582

@@ -556,6 +594,7 @@ git author
556594
from any Git repository, and it will invoke git-author through Docker.
557595

558596
## Git Alias
597+
559598
If you install the `git-author` binary somewhere in your path, running `git author`
560599
will automatically invoke it with no further configuration. This is a Git
561600
feature.
@@ -572,6 +611,7 @@ See [here](https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases) for more
572611
information about Git aliases.
573612

574613
## Git Mailmap
614+
575615
Quite often, people end up committing to a repository under different names or
576616
using different email addresses. For example, someone might make a commit using
577617
the name "Nathan Smith" and their work email address and then later make a
@@ -586,7 +626,9 @@ mailmap](https://git-scm.com/docs/gitmailmap). If a `.mailmap` file is present
586626
in a Git repository, `git author` will respect it.
587627

588628
## What Exactly Do These Numbers Mean?
629+
589630
### Metrics
631+
590632
The number of **commits** shown for each author is the number of unique commits
591633
found while walking the commit log. When supplying a path argument to `git
592634
author`, the commits walked include only commits modifying the given path(s).
@@ -603,6 +645,7 @@ all files in the case of no path arguments. In Git, modifying a line counts as
603645
removing it and then adding the new version of the line.
604646

605647
### Merge Commits
648+
606649
Merge commits are not counted toward any of these metrics. The rationale here
607650
is that merge commits represent a kind of overhead involved in managing the
608651
commit graph and that all novel changes will already have been introduced to
@@ -614,6 +657,7 @@ for each author. Merge commits are still ignored for the purposes of the file
614657
total or lines total.
615658

616659
### Differences From `git blame`
660+
617661
Whereas `git blame` starts from the code that exists in the working tree and
618662
identifies the commit that introduced each line, `git author` instead walks some
619663
subset of the commit log tallying contributions. This means that `git blame`
@@ -644,7 +688,9 @@ up with the code in this file?", perhaps because the question is too ambiguous.
644688
tree?"
645689

646690
## DEVELOPMENT
691+
647692
### Test Repository Submodule
693+
648694
Some of the automated tests for `git-author` need to run against a Git repository.
649695
A test repository is attached to this repository as a submodule.
650696

@@ -668,4 +714,4 @@ Once your pull request has been merged, you can delete your branch.
668714

669715
## 📝 License
670716

671-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
717+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)