对于git中的某些子命令,如果不指定任何参数,则会为该命令获得一个方便的“使用”输出。示例:
$ git blame
usage: git blame [options] [rev-opts] [rev] [--] file
[rev-opts] are documented in git-rev-list(1)
--incremental Show blame entries as we find them, incrementally
-b Show blank SHA-1 for boundary commits (Default: off)
--root Do not treat root commits as boundaries (Default: off)
--show-stats Show work cost statistics
--score-debug Show output score for blame entries
-f, --show-name Show original filename (Default: auto)
-n, --show-number Show original linenumber (Default: off)
-p, --porcelain Show in a format designed for machine consumption
--line-porcelain Show porcelain format with per-line commit information
-c Use the same output mode as git-annotate (Default: off)
-t Show raw timestamp (Default: off)
-l Show long commit SHA1 (Default: off)
-s Suppress author name and timestamp (Default: off)
-e, --show-email Show author email instead of name (Default: off)
-w Ignore whitespace differences
--minimal Spend extra cycles to find better match
-S <file> Use revisions from <file> instead of calling git-rev-list
--contents <file> Use <file>'s contents as the final image
-C[<score>] Find line copies within and across files
-M[<score>] Find line movements within and across files
-L <n,m> Process only line range n,m, counting from 1
--abbrev[=<n>] use <n> digits to display SHA-1s但是,有些子命令实际上是在没有传递参数时执行的,例如git log。我已经查看了git help的文档,但是我看不出有一种方法可以简单地显示命令的“使用”,而不是拔出我的web浏览器。有人知道我怎样才能像git blame那样强迫子命令将其使用信息显示到命令行吗?
我在Windows上使用msysgit 1.9.2。提前谢谢。
发布于 2014-05-16 15:36:56
使用git add -h而不是git add --help。
[:~] $ git add -h
usage: git add [options] [--] <pathspec>...
-n, --dry-run dry run
-v, --verbose be verbose
-i, --interactive interactive picking
-p, --patch select hunks interactively
-e, --edit edit current diff and apply
-f, --force allow adding otherwise ignored files
-u, --update update tracked files
-N, --intent-to-add record only the fact that the path will be added later
-A, --all add changes from all tracked and untracked files
--ignore-removal ignore paths removed in the working tree (same as --no-all)
--refresh don't add, only refresh the index
--ignore-errors just skip files which cannot be added because of errors
--ignore-missing check if - even missing - files are ignored in dry runhttps://stackoverflow.com/questions/23699228
复制相似问题