这个教程将帮助你在本地环境中设置起git的HTML帮助文档。HTML格式的帮助文档看起来更清晰,更详细,并且还有使用示例。
一,运行git help –-web commit查看git默认的保存html文件的路径。
$ git help --web commit
#Attempt to open the html help for the commit command
#fatal: '/usr/local/git/share/doc/git-doc': not a documentationdirectory.
我们得到了git默认的存放html文件的路径是’/usr/local/git/share/doc/git-doc’。当然你得到的路径有可能和这个不一样。
二,切换到这个路径下,迁出存放在git repo中的html文件。
$ sudo mkdir -p /usr/local/git/share/doc
# Create the path for the docs to be installed to cd #/usr/local/git/share/doc
$ sudo git clone git://git.kernel.org/pub/scm/git/git-htmldocs.git git-doc
# Clone the git repo and check out the html documents branch
三,运行 vim ~/.gitconfig 命令,在.gitconfig文件中加入如下配置。
[help]
format = web
[web]
browser = open
当然也可以使用其他的编辑器来编辑.gitconfig文件。
只要这三步就设置起了本地的HTML帮助文档。你可以再次运行git help -–web commit,就可以查看在浏览器中自动打开的HTML帮助说明页面了。
如果git的帮助文档更新了,如何同步到本地那?很简单,运行git pull命令就行。
$ cd /usr/local/git/share/doc/git-doc
$ sudo git pull