请注意,在使用“ git log-n 1[ Branch _ name ]”选项时。- n 只返回一行日志,但不保证返回的顺序。
下面是从 git-log 手册页中提取的内容
.....
.....
Commit Limiting
Besides specifying a range of commits that should be listed using the special notations explained in the description, additional commit limiting may be applied.
Using more options generally further limits the output (e.g. --since=<date1> limits to commits newer than <date1>, and using it with --grep=<pattern> further limits to commits whose log message has a line that matches <pattern>), unless otherwise noted.
Note that these are applied before commit ordering and formatting options, such as --reverse.
-<number>
-n <number>
.....
.....
Adding to John Szakmeister's excellent answer above (https://stackoverflow.com/a/15679887/4597676), you could do this without touching the mouse by piping the output of git rev-parse BRANCHNAME to a command like pbcopy or similar: