git logのエイリアスを設定

アリスとボブのGit入門レッスン

アリスとボブのGit入門レッスン

この本のp.124を参考にしてみた。

$ git log --oneline --graph --decorate --all

をgit loggraphというコマンドに設定する。

$ git config --global alias.loggraph 'log --oneline --graph --decorate --all'

上記のコマンドを設定すると ~/.gitconfig に

[alias]
        loggraph = log --oneline --graph --decorate --all

が追加されます。
ちなみに--onelineはGit - git-log Documentationによると

--oneline::
	This is a shorthand for "--pretty=oneline --abbrev-commit"
	used together.

(一行目のタイトル行表示&ハッシュの冒頭表示)とのこと。
また--decorateはタグ名が表示されます。

--decorate[=short|full|no]
Print out the ref names of any commits that are shown. If short is specified, the ref name prefixes refs/heads/, refs/tags/ and refs/remotes/ will not be printed. If full is specified, the full ref name (including prefix) will be printed. The default option is short.

なお--prettyと(上記書籍で挙げられている)--formatは同じようです。

--pretty[=<format>]::
--format=<format>::

	Pretty-print the contents of the commit logs in a given format,
	where '<format>' can be one of 'oneline', 'short', 'medium',
	'full', 'fuller', 'email', 'raw' and 'format:<string>'.  See
	the "PRETTY FORMATS" section for some additional details for each
	format.  When omitted, the format defaults to 'medium'.
+
Note: you can specify the default pretty format in the repository
configuration (see linkgit:git-config[1]).

その他はこちらも参考に。

git log --graph --all --color --pretty='%x09%h %cn%x09%s %Cred%d'
 --graph: ツリー表示が付く
 --all: 全てのログ。カレントのブランチだけに限らず。
 --color: 色
 --pretty: ログのフォーマット。%dが branch。
git logで、gitk --all くらい情報ほしい CodingFirst