{"id":13998227,"url":"https://github.com/zegl/extremely-linear","last_synced_at":"2025-04-05T07:05:12.708Z","repository":{"id":63624602,"uuid":"568852383","full_name":"zegl/extremely-linear","owner":"zegl","description":"Extremely Linear Git History // git-linearize","archived":false,"fork":false,"pushed_at":"2024-02-26T08:37:45.000Z","size":55,"stargazers_count":513,"open_issues_count":3,"forks_count":11,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-11T23:33:59.083Z","etag":null,"topics":["git"],"latest_commit_sha":null,"homepage":"https://westling.dev/b/extremely-linear-git","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zegl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"polar":"zegl"}},"created_at":"2022-11-21T14:48:33.000Z","updated_at":"2024-10-05T09:47:04.000Z","dependencies_parsed_at":"2024-01-15T19:44:13.157Z","dependency_job_id":"4334010e-a904-4ec1-a099-c94339065dcd","html_url":"https://github.com/zegl/extremely-linear","commit_stats":{"total_commits":57,"total_committers":1,"mean_commits":57.0,"dds":0.0,"last_synced_commit":"000005608b5c9f61a08e60c270893ff0c44ff431"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zegl%2Fextremely-linear","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zegl%2Fextremely-linear/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zegl%2Fextremely-linear/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zegl%2Fextremely-linear/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zegl","download_url":"https://codeload.github.com/zegl/extremely-linear/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299831,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git"],"created_at":"2024-08-09T19:01:29.366Z","updated_at":"2025-04-05T07:05:12.692Z","avatar_url":"https://github.com/zegl.png","language":"Shell","funding_links":["https://polar.sh/zegl"],"categories":["Shell"],"sub_categories":[],"readme":"# Extremely Linear Git History\n\n\u003e Dreaming of a git commit history that looks like this?\n\n\u003cimg width=\"1197\" alt=\"Screenshot 2022-11-22 at 16 16 40\" src=\"https://user-images.githubusercontent.com/47952/203351228-383cd585-c135-4f63-ac3d-8f10707cc9c7.png\"\u003e\n\n* Create meaningful checksums: The first commit is `0000000`, then `0000001`, then `0000002`\n* Easy overview of your history\n* No need for semver or other external versioning, your commits are your version numbers\n* With the `shit` (\"short git\") wrapper, you can use commands like `shit show 14`, and `shit log 100..150`\n* 100% production ready, 0% recommended\n\n## Installation\n\n```bash\nbrew install zegl/tap/git-linearize zegl/tap/git-shit\n```\n\nor copy the scripts (from the root of this repo) to somewhere on your PATH.\n\n## Usage\n\nRun as `git linearize`.\n\n```\ngit linearize - Create an extremely linear git history - github.com/zegl/extremely-linear\n\ngit linearize [command] [options]\n\ncommand: (default command is to run the linearization process)\n  -h, --help           show brief help\n  --install-hook       installs git-linearize as a post-commit hook (current repo only)\n  --make-epoch         makes the current commit the linearized epoch (00000000), use to adopt git-linearize in\n                       existing repositories without having to rewrite the full history\n\ngeneral options (for all command):\n  -v, --verbose                   more verbose logging\n  --short                         use shorter 6 digit prefix (quick mode)\n  --format [format]               specify your own prefix format (pritnf style)\n  --if-branch [name]              only run if the current branch is [name]\n\n  All command generally support all general options. For example, specifying --format to --install-hook means\n  that git-linearize will be called with the same format in the future when triggered by the hook.\n```\n\ngit-linearize requires the history to already be linear (no merge commits).\n\n**Beware:** git-linearize will rebase your entire project history. Do not run unless you know what you're doing. Create a backup first!\n\n## `shit` – \"short git\"\n\nThis repository also contains `shit`. A git wrapper that converts non-padded prefixes to their padded counterpart.\n\n* `shit show 14` translates to `git show 00000140`\n* `shit log 10..14` --\u003e `git log 00000100..00000140`\n\nInstall with `brew install zegl/tap/git-shit`, or copy the [the script](https://github.com/zegl/extremely-linear/blob/main/shit) to somewhere on your PATH.\n\n\n# What's happening here\n\n\u003e Read more in the [\"Extremely Linear Git History\"](https://westling.dev/b/extremely-linear-git) blog post.\n\nThe hash of a git commit is created by combining the tree, commit parent(s), author, and the commit message.\n\ngit-linearize uses [lucky_commit](https://github.com/not-an-aardvark/lucky-commit) which inserts invisible whitespace characters at the end of the commit message until we get a SHA1 hash with the desired prefix.\n\n`git-linearize` will convert/rebase your repository so that the first commit in the history has a prefix that starts with `00000000`, the second commit will have the prefix `00000010`, the third one will have `00000020` and so on.\n\n## Prefix format\n\nMany git clients and forges, abbreviate commit hashes to the first 7 characters. git-linearize uses the first 7 characters for the counter (0 to 9 999 999), followed by a fixed 0, making the total prefix length 8 characters long.\n\n```\n| NNNNNNN | 0 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |\n| counter |    \\                 can be anything |\n           \\ always zero\n```\n\n## Performance? Is this fast? 🏎\n\nThanks to the GPU powered crashing in lucky_commit, generating a 8 character prefix takes roughly 2 seconds on my computer (2021 Macbook Pro with M1 Pro).\n\nUsing CPU-only crashing (if your computer does not have a GPU) attached, the same operation takes ~43 seconds on the same computer.\n\n# Future ideas and epic hacks\n\n* A pre-merge GitHub action that runs git-linearize\n* ✅ A post-commit commit hook\n* Make it easier to organize git-linearize on multiple branches (see: --if-branch)\n\n# Credits\n\nThanks to [lucky_commit](https://github.com/not-an-aardvark/lucky-commit) and [githashcrash](https://github.com/Mattias-/githashcrash) for the hard work of actually crunching the checksums, and for the inspiration to this project.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzegl%2Fextremely-linear","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzegl%2Fextremely-linear","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzegl%2Fextremely-linear/lists"}