https://github.com/geraintluff/git-mine
Amends Git's current HEAD to minimise the commit ID
https://github.com/geraintluff/git-mine
Last synced: 29 days ago
JSON representation
Amends Git's current HEAD to minimise the commit ID
- Host: GitHub
- URL: https://github.com/geraintluff/git-mine
- Owner: geraintluff
- Created: 2016-04-11T21:28:05.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-02-18T12:15:18.000Z (over 4 years ago)
- Last Synced: 2025-01-28T21:18:25.530Z (over 1 year ago)
- Language: Python
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# git-mine
Python script that amends Git's current HEAD to minimise the commit ID.
## Usage:
The only argument is the limit (in hex) below which the tool will exit.
```
./git-mine.py 000001
```
This will exit when the commit ID for HEAD starts `000000...`
If the limit is omitted, then it defaults to `0001` (first 16 bits zeros).
The limit is a lexical comparison on the hex representation - to continue infinitely, specify `-` as the limit.
## Use as `post-commit` hook
If you'd like this script to run after every commit, copy `git-mine.py` into the file `.git/hooks/post-commit`. It must be marked as executable.
If you want to specify a limit other than the default, you can write a script for `.git/hooks/post-commit` (must be executable) that provides it:
```
#!/bin/bash
/location/to/git-mine.py 0001
```
Alternatively, you could just change `DEFAULT_LIMIT` in the source.