This script generates a Markdown-formatted link to the most recent Git commit in a repository, including the commit’s date/time, short SHA, and message. It’s designed for use as a Git alias but can also be run standalone.
- Converts SSH repository URLs to HTTPS automatically.
- Outputs a link in the format:
For example:[YYYY-MM-DD HH:MM - shortSHA - commit message](repo_url/commit/shortSHA) #git/commit
[2024-12-19 11:57 - a4a92bf5 - Merge pull request #2](https://github.com/HBS-HBX/graph-ai-nego/commit/a4a92bf5) #git/commit
- Supports a
--short
mode to output only the commit URL.
- Save the
generate_markdown_commit_link.zsh
script to~/.config/git/scripts/
. - Add the alias to your
~/.gitconfig
:[alias] md-commit = "!zsh ~/.config/git/scripts/generate_markdown_commit_link.zsh"
After that, you can run git md-commit
to generate the Markdown link.