git logã®ãªãã·ã§ã³ãããã
æ®æ®µä½æ°ãªãgit logå©ãã¦ããã©ãå®ã¯ãªãã·ã§ã³ãå¤ãã¦é©ããã
èªåçã«ä½¿ããããªãã®ãã¡ã¢ãã¦ããã
åèãµã¤ã
åã®èããæå¼·ã®ry
è²ã 調ã¹ãçµæãèªåã§ä½¿ããªããããªã¨ããããªã¼ã¨ããçµè«ã«è³ã£ã
$ git log --graph --name-status --pretty=format:"%C(red)%h %C(green)%an %Creset%s %C(yellow)%d%Creset"
ãã®ã¾ã¾ä½¿ãã«ã¯é·ãããã®ã§ã¨ã¤ãªã¢ã¹ã«ãã¦ãã
$ git config --global alias.mylog 'log --graph --name-status --pretty=format:"%C(red)%h %C(green)%an %Creset%s %C(yellow)%d%Creset"'
以ä¸ãgit logã®ãªãã·ã§ã³ãããã
表示ããã³ãããæ°ãå¶éãã -n num / -num
$ git log -n 5 $ git log -5
åã³ãããã®diffã表示ãã -p
ãªãã·ã§ã³ç¡ãã ã¨ã³ãããIDãAuithorãDateãã³ãããã¡ãã»ã¼ã¸ã ãã®è¡¨ç¤ºã ãã-pãã¤ããã°å¤æ´ãããdiffã表示ããã
$ git log -p commit 7a3b16394b8164ef708caa5686f4cced9f976a0e Author: EC2 Default User <[email protected]> Date: Tue Jul 16 02:50:05 2013 +0900 second? diff --git a/first.txt b/first.txt index 5ec586d..31ad3ce 100644 --- a/first.txt +++ b/first.txt @@ -1 +1,2 @@ first commit +second
ã³ãããIDãç縮表示 --abbrev-commit
SHA-1ãé·ãã¦ãã ãªã¼ã¨æã£ãã¨ãã«
ãã¼ã¸ã³ãããã表示ããªã --no-merges
ãªãªã¼ã¹ç¨ãã©ã³ãã¨ããã£ãããã¼ã¸ã³ãããå¤ããã ãã...
ãã°ã1è¡è¡¨ç¤ºã«ãã --pretty=oneline / --oneline
æ£ããã¯--pretty=onelineã1è¡è¡¨ç¤ºã§ã--onelineã¯--pretty=onelineã--abbrev-commitã¨åãæå³ããã
$ git log --pretty=oneline 7a3b16394b8164ef708caa5686f4cced9f976a0e second? $ git log --oneline 7a3b163 second?
ãã©ã³ããã¿ã°åãè¿½è¨ --decorate
å人çã«ç¡åãã©ã³ãåã£ãæã«ã©ãã®ãã©ã³ãæ´¾çã確èªããããã
ã°ã©ã表示 --graph
ãã¼ã¸ããå¾ã®ç¢ºèªã«ä¾¿å©ã»ã»ã»ããªï¼
--onelineã¨çµã¿åãããã¨èªã¿ããã
* commit 34331a8c5f761489baf151d97ae9e40702325164 |\ Merge: 3756bff 7a3b163 | | Author: EC2 Default User <[email protected]> | | Date: Tue Jul 16 03:07:35 2013 +0900 | | | | Merge branch 'feature' | | | * commit 7a3b16394b8164ef708caa5686f4cced9f976a0e |/ Author: EC2 Default User <[email protected]> | Date: Tue Jul 16 02:50:05 2013 +0900 | | second? | * commit 3756bfff44b99e56da2182521f0b0d07af940323
ã³ãããã«ããå¤æ´ãã¡ã¤ã«ã¨å¤æ´æ¹æ³ã ã表示 --name-status
$ git log --name-status commit 7a3b16394b8164ef708caa5686f4cced9f976a0e Author: EC2 Default User <[email protected]> Date: Tue Jul 16 02:50:05 2013 +0900 second? M first.txt
--onelineã¨çµã¿åãããã¨èªã¿ãããæã
$ git log --name-status --oneline 7a3b163 second? M first.txt
2ã¤ã®ãã©ã³ãéã§ç°ãªãã³ãããã ãåºå
ã§ãããã¨ãç¥ããªãã£ãï¼
2ã¤ã®ãã©ã³ãã..ã§ã¤ãªãã§æå®ããã ã
ã©ã¡ãã®ãã©ã³ãã«å«ã¾ããã³ãããããåºããªã --left-rightãªãã·ã§ã³ãä»ãã
$ git log --left-right master..feature commit > 7a3b16394b8164ef708caa5686f4cced9f976a0e Author: EC2 Default User <[email protected]> Date: Tue Jul 16 02:50:05 2013 +0900 second?
ç¹å®Authorã®ã³ãããã ãã表示 --author=regexp
grepãããªãã¦æ ¼å¥½æªãçä¼¼ã¯ããããªãã£
$ git log --author=ec2-user
ãã°åºåãã©ã¼ãããã®æå® pretty=format:"(format)"
ãã©ã¼ãããæå®ã§ãã°åºåããæ¹æ³ãåºåãæå®ãããªãã·ã§ã³ãããã¤ããããã©ã使ããããªã®ã¯ä»¥ä¸ããªã
%H ã³ãããã®ããã·ã¥ %h ã³ãããã®ããã·ã¥ (ç縮ç) %ad Author ã®æ¥ä» %an Author ã®åå %ar Author ã®ç¸å¯¾æ¥ä» %s ã³ãããã¡ãã»ã¼ã¸ %d ãã©ã³ã/ã¿ã°å %C([color]) ãã以éã®åºåãcolorã«å¤ãã [color] = ["Black","Red","Green","Yellow","Blue","Magenta","Cyan","White"] %Creset ãã以éã®åºåãããã©ã«ãã«æ»ã
ãããªæãã«åºåããã
$ git log --pretty=format:"%h - %an, %ar : %s" 34331a8 - EC2 Default User, 8 minutes ago : Merge branch 'feature' 7a3b163 - EC2 Default User, 25 minutes ago : second?