You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55-20Lines changed: 55 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,36 +67,70 @@ Is your Git repository bursting at the seams?
67
67
68
68
## Getting started
69
69
70
-
1.[Install the Git command-line client](https://git-scm.com/)and put it in your `PATH`. (`git-sizer` invokes `git` commands to examine the contents of your repository.)
70
+
1.Make sure that you have the [Git command-line client](https://git-scm.com/)installed. NOTE: `git-sizer` invokes `git` commands to examine the contents of your repository, so **it is required that the `git` command be in your `PATH`** when you run `git-sizer`.
71
71
72
-
2.Build:
72
+
2.Install `git-sizer`. Either:
73
73
74
-
* On Linux or OS X:
74
+
a. Install a released version of `git-sizer` (recommended):
75
75
76
-
script/bootstrap
77
-
make
76
+
* Go to [the releases page](https://github.com/github/git-sizer/releases) and download the ZIP file corresponding to your platform.
78
77
79
-
The executable file is written to `bin/git-sizer`. If you copy it to your `PATH`, you can run the program by typing `git sizer`; otherwise, you need to type the full path and filename to run it; e.g., `bin/git-sizer`.
78
+
* Unzip the file.
80
79
81
-
*On other platforms: TBD
80
+
* Move the executable file (`git-sizer` or `git-sizer.exe`) into your `PATH`.
82
81
83
-
3. Change to the directory containing the Git repository, then run
82
+
b. Install `git-sizer` using `go get`:
84
83
85
-
git sizer [<opt>...]
84
+
* Make sure that you have a recent version of the [Go language toolchain](https://golang.org/doc/install) installed and that you have set `GOPATH`.
86
85
87
-
To get a summary of the current repository, all you need is
86
+
* Get `git-sizer` using `go get`:
88
87
89
-
git sizer
88
+
go get github.com/github/git-sizer
90
89
91
-
Use the `--json` option to get output in JSON format, including the raw numbers.
90
+
This should fetch and compile the source code and write the executable file to `$GOPATH/bin/`.
91
+
92
+
* Either add `$GOPATH/bin` to your `PATH`, or copy the executable file (`git-sizer` or `git-sizer.exe`) to a directory that is already in your `PATH`.
93
+
94
+
c. Build using `make` (for experts; works on Linux or OS X):
95
+
96
+
* Clone the `git-sizer` Git repository and switch to that directory:
97
+
98
+
git clone https://github.com/github/git-sizer.git
99
+
cd git-sizer
100
+
101
+
* Install Go if necessary and create and prepare a project-local `GOPATH`:
102
+
103
+
script/bootstrap
104
+
105
+
* Build `git-sizer`:
106
+
107
+
make
108
+
109
+
* Copy the resulting executable file (`bin/git-sizer`) to a directory in your `PATH`.
110
+
111
+
Assuming that you have installed the `git-sizer` executable to your `PATH`, you can run the program via Git by typing `git sizer`; otherwise, you need to type the full path and filename to run it; e.g., `/path/to/bin/git-sizer`.
112
+
113
+
3. Change to the directory containing the Git repository that you'd like to analyze, then run
114
+
115
+
git sizer [<option>...]
116
+
117
+
No options are required. You can learn about available options by typing `git sizer -h` or by reading on.
118
+
119
+
(The above command assumes that you have added `git-sizer` to your `PATH`. If you don't add it to your `PATH`, you need to type its full path and filename to run it; e.g., `/path/to/bin/git-sizer`.)
92
120
93
121
94
122
## Usage
95
123
96
-
By default, `git-sizer` outputs its results in tabular format. For example, let's use it to check[the Linux repository](https://github.com/torvalds/linux), using the `--verbose` option to cause all statistics to be output:
124
+
By default, `git-sizer` outputs its results in tabular format. For example, let's use it to analyze[the Linux repository](https://github.com/torvalds/linux), using the `--verbose` option so that all statistics are output:
`git-sizer` has to traverse all of the history, so the analysis can take a while.
153
-
154
-
The output is a table showing the thing that was measured, its numerical value, and a rough indication of which values might be a cause for concern.
186
+
The output is a table showing the thing that was measured, its numerical value, and a rough indication of which values might be a cause for concern. In all cases, only objects that are reachable from references are included (i.e., not unreachable objects, nor objects that are reachable only from the reflogs).
155
187
156
188
The "Overall repository size" section includes repository-wide statistics about distinct objects, not including repetition. "Total size" is the sum of the sizes of the corresponding objects in their uncompressed form, measured in bytes.
157
189
158
190
The "Biggest objects" section provides information about the biggest single objects of each type, anywhere in the history.
159
191
160
192
In the "History structure" section, "maximum history depth" is the longest chain of commits in the history, and "maximum tag depth" reports the longest chain of annotated tags that point at other annotated tags.
161
193
162
-
The "Biggest checkouts" section is about the sizes of commits as checked out into a working copy. "Maximum path depth" is the largest number of path components within the repository, and "maximum path length" is the longest path in terms of bytes. "Total size of files" is the sum of all file sizes in the single biggest commit, including multiplicities if the same file appears multiple times.
194
+
The "Biggest checkouts" section is about the sizes of commits as checked out into a working copy. "Maximum path depth" is the largest number of path components for files in the working copy, and "maximum path length" is the longest path in terms of bytes. "Total size of files" is the sum of all file sizes in the single biggest commit, including multiplicities if the same file appears multiple times.
163
195
164
196
The "Value" column displays counts, using units "k" (thousand), "M" (million), "G" (billion) etc., and sizes, using units "B" (bytes), "KiB" (1024 bytes), "MiB" (1024 KiB), etc. Note that if a value overflows its counter (which should only happen for malicious repositories), the corresponding value is displayed as `∞` in tabular form, or truncated to 2³²-1 or 2⁶⁴-1 (depending on the size of the counter) in JSON mode.
165
197
166
-
The "Level of concern" column uses asterisks to indicate values that seem high compared with "typical" Git repositories. The more asterisks, the more inconvenience this value might be expected to cause. Exclamation points indicate values that are extremely high (i.e., equivalent to more than 30 asterisks).
198
+
The "Level of concern" column uses asterisks to indicate values that seem high compared with "typical" Git repositories. The more asterisks, the more inconvenience this aspect of your repository might be expected to cause. Exclamation points indicate values that are extremely high (i.e., equivalent to more than 30 asterisks).
167
199
168
200
The footnotes list the SHA-1s of the "biggest" objects referenced in the table, along with a more human-readable `<commit>:<path>` description of where that object is located in the repository's history. Given the name of a large object, you could, for example, type
169
201
@@ -173,16 +205,19 @@ at the command line to view the contents of the object. (Use `--names=none` if y
173
205
174
206
By default, only statistics above a minimal level of concern are reported. Use `--verbose` (as above) to request that all statistics be output. Use `--threshold=<value>` to suppress the reporting of statistics below a specified level of concern. (`<value>` is interpreted as a numerical value corresponding to the number of asterisks.) Use `--critical` to report only statistics with a critical level of concern (equivalent to `--threshold=30`).
175
207
208
+
If you'd like the output in machine-readable format, including exact numbers, use the `--json` option.
209
+
176
210
To get a list of other options, run
177
211
178
-
git sizer --help
212
+
git sizer -h
179
213
180
-
The Linux repository is large by most standards, and as you can see, it is pushing some of Git's limits. And indeed, some Git operations on the Linux repository (e.g., `git fsck`, `git gc`) take a while. But due to its sane structure, none of its dimensions are wildly out of proportion to the size of the code base, so it can be managed successfully using Git.
214
+
The Linux repository is large by most standards. As you can see, it is pushing some of Git's limits. And indeed, some Git operations on the Linux repository (e.g., `git fsck`, `git gc`) do take a while. But due to its sane structure, none of its dimensions are wildly out of proportion to the size of the code base, so the kernel project is managed successfully using Git.
181
215
182
216
Here is the non-verbose output for one of the famous ["git bomb"](https://kate.io/blog/git-bomb/) repositories:
0 commit comments