使用 Git 時需要獲取幫助,有三種方法可以找到 Git 命令的使用手冊:
$ git help <verb>
$ git <verb> --help
$ man git-<verb>
例如,要想獲得 config 命令的手冊,執(zhí)行
$ git help config
這些命令的好處是隨時隨地可以使用而無需聯(lián)網(wǎng)。
[root@localhost ~]# git help config
No manual entry for git-config
[root@localhost ~]# git --version
git version 2.9.3
如上git的幫助命令不能用,提示:No manual entryfor git-<verb>
是因為git的幫助文檔(man page)缺失導(dǎo)致,可以去git的man文件夾驗證下(路徑是/usr/local/share/man目錄)。
解決方法:可以從以下兩個地方下載比較權(quán)威的man page文檔:
- http://code.google.com/p/git-core/downloads/list
- 從以下地址git clone
git://git.kernel.org/pub/scm/git/git-manpages.git
https://git.kernel.org/pub/scm/git/git-manpages.git
https://kernel.googlesource.com/pub/scm/git/git-manpages.git
將下載下來的man page文件拷貝進git的man文件夾里即可。
CLI命令如下:
[root@localhost ~]# cd /usr/local/share/man
[root@localhost man]# git clone http://git.kernel.org/pub/scm/git/git-manpages.git
[root@localhost man]# ls
git-manpages man1x man2x man3x man4x man5x man6x man7x man8x man9x
man1 man2 man3 man4 man5 man6 man7 man8 man9 mann
[root@localhost man]# ls git-manpages/
man1 man5 man7
[root@localhost man]# cp -r /usr/local/share/man/git-manpages/* /usr/local/share/man/
[root@localhost man]# git help config
驗證發(fā)現(xiàn)出現(xiàn)了幫助信息,這樣就可以使用git help命令咯