git logコマンドでコミットログを一行で表示する方法
git logコマンドでコミットログを一行で表示するには--onelineオプションを指定します。
オプションの説明
--oneline This is a shorthand for "--pretty=oneline --abbrev-commit" used together. -<number>, -n <number>, --max-count=<number> Limit the number of commits to output.
--onelineオプションを指定した場合(-nオプションは出力するコミット数の指定)
$ git log --oneline -n 10 8b7c11b866 (HEAD -> master, origin/master, origin/HEAD) The fifth batch 96ac07f4a9 Merge branch 'ab/help-autocorrect-prompt' 613204b948 Merge branch 'cb/ci-build-pedantic' 9762646ee4 Merge branch 'gh/gitweb-branch-sort' 05665a0dff Merge branch 'rs/archive-use-object-id' 09f66eb0e2 Merge branch 'rs/show-branch-simplify' bfe37f3dc5 Merge branch 'jk/log-warn-on-bogus-encoding' a4b1a0ade4 Merge branch 'cb/remote-ndebug-fix' fd0d7036e0 Merge branch 'ab/retire-advice-config' 6d09fc54f6 Merge branch 'mk/clone-recurse-submodules'
--onelineオプションを指定しない場合
$ git log -n 2 commit 8b7c11b8668b4e774f81a9f0b4c30144b818f1d1 (HEAD -> master, origin/master, origin/HEAD) Author: Junio C Hamano <gitster@pobox.com> Date: Fri Sep 10 11:47:10 2021 -0700 The fifth batch Signed-off-by: Junio C Hamano <gitster@pobox.com> commit 96ac07f4a93ae9c2012c7b13aa204d39e8cba6e1 Merge: 613204b948 dc66e3c799 Author: Junio C Hamano <gitster@pobox.com> Date: Fri Sep 10 11:46:33 2021 -0700 Merge branch 'ab/help-autocorrect-prompt' The logic for auto-correction of misspelt subcommands learned to go interactive when the help.autocorrect configuration variable is set to 'prompt'. * ab/help-autocorrect-prompt: help.c: help.autocorrect=prompt waits for user action