Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding 'git help' for alias commands?

Tags:

git

alias

I've implemented a Git command and used git aliases to hook it into Git but is there a way to hook the Git help? I'm running on Windows and if I issue git help mycmd I get a popup telling me that Git can't find a git-mycmnd.html file.

I've implemented my command using Python so is there a proper Git-ish way to add the help in, other than 'just knowing' where help files have to be placed?

like image 496
Paul D Smith Avatar asked Jun 17 '19 09:06

Paul D Smith


1 Answers

You can have customised documentation for for your aliases, and the documentation can be either locally saved or online accessible over the web. Here's how it works:

First: set the help format

git config --local help.format html

Second: clone the official get documentation

cd ~/Documents

git clone git://git.kernel.org/pub/scm/git/git-htmldocs.git git-doc

Third: add a simple HTML page that contains documentation for your command

Assuming your command is love so:

cd ~/Documents/git-doc
touch gitlove.html 
Add some text to the gitlove.html

Fourth: configure your repo to link to the documentation repo

cd YOUR_PROJECT_REPO
git config --local help.htmlpath ~/Documents/git-doc

Now you can do: git help love and your html page will pop up.

Enjoy!

like image 162
William Kinaan Avatar answered Sep 23 '22 01:09

William Kinaan