LoginSignup
129
124

More than 5 years have passed since last update.

git logにブランチ名を表示する git log --oneline --graph --decorate=fullのススメ

Posted at

コミットログの表示

git log

ローカルのコミットログ(ハッシュ値、編集者、編集日時、メッセージ)を表示

* commit 1235f58b72bd3323375debbc783a508d8328277cce5
| Author: Masaru Furuya
| Date:   Fri May 16 00:54:09 2014 +0900
| 
|     git test

コミットログをグラフ表示にする

git log --graph

* commit 2rr29dd167c5d38fec823f2c90fb4896536a6214
| Author: Masaru Furuya
| Date:   Thu May 15 19:22:14 2014 +0900
| 
|     
|    
*   commit 9003273439ba845614650688d7bb752614ec6231
|\  Merge: 90b2dd4 4034903
| | Author: Masaru Furuya
| | Date:   Thu May 15 18:32:17 2014 +0900
| | 
| |     Merge branch 'git_test2' into git_test
| |   
| * commit 1334fa8d01d0a17e679eb3b94a3db5479a144223

コミットの推移をグラフ表示にしてくれる

コミットログを1行で表示する

git log --oneline

10029dd git test3
3453273 git test2
134bfa8 git test1

余計な情報は全て省略され、ハッシュ値とコミットメッセージのみの表示となる

コミットログにブランチ名を表示する

git log --graph --oneline --decorate=full

* 1ee29dd (HEAD, origin/git_test, origin/HEAD, git_test2, git_test) 
* *   1233273 Merge branch 'git_test2' into git_test
|\  
| * 135bfa8 git_test2
| *   111b0f1 git_test4 Merge branch 'git_test3'
| |\  
| |/  
|/|   
* | 01b2dd4 git_test

--decorate=full

をオプションとしてつけるとカラフルになるだけでなく、
ローカルとリモートのブランチ名を表示してくれるようになる

いちいち、このコマンドをうつのもめんどくさいので、
自分はgitcofigにエイリアスとして登録している

[alias]
graph=log --graph --oneline --decorate=full

git logはHEADの変化のログであるgit reflogと合わせて使えば、
何かあった時に復旧するのにとても便利なコマンドです。

ぜひ自分にあったオプションを見つけて見て下さい。

129
124
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
129
124