05 February 2016

usage

  1. git log

         # show all history
         # page up/down q for exit
    
    1. -n show first n logs

       $ git log -1
       commit ea33dbb2be5bc398a547181b2b23db664f63c31d
       Author: gree2 <hqlgree2@gmail.com>
       Date:   Thu Feb 4 15:47:59 2016 +0800
      
           refactor categories
      
    2. --stat -n

       $ git log --stat -1
       ommit ea33dbb2be5bc398a547181b2b23db664f63c31d
       Author: gree2 <hqlgree2@gmail.com>
       Date:   Thu Feb 4 15:47:59 2016 +0800
      
           refactor categories
      
        _posts/2015-03-14-eastern-pioneer-bus-android.md                      | 4 ++--
        _posts/2015-03-24-grand-central-dispatch-tutorial-for-swift-part-2.md | 2 +-
        _posts/2015-04-22-python-read-file-encoding-and-convert-to-utf-8.md   | 4 ++--
        _posts/2015-06-23-vagrant-getting-started.md                          | 5 ++---
        _posts/2016-01-13-python-play-with-bokeh.md                           | 2 +-
        _posts/2016-01-29-deploying-the-bokeh-server.md                       | 2 +-
        6 files changed, 9 insertions(+), 10 deletions(-)
      
    3. -p -n

       $ git log -p -1
       commit ea33dbb2be5bc398a547181b2b23db664f63c31d
       Author: gree2 <hqlgree2@gmail.com>
       Date:   Thu Feb 4 15:47:59 2016 +0800
      
           refactor categories
      
       diff --git a/_posts/2015-03-14-eastern-pioneer-bus-android.md b/_posts/2015-03-14-eastern-pioneer-bus-android.md
       index fcbd372..3e62769 100644
       --- a/_posts/2015-03-14-eastern-pioneer-bus-android.md
       +++ b/_posts/2015-03-14-eastern-pioneer-bus-android.md
       @@ -2,7 +2,7 @@
        layout: post
        title: "eastern pioneer bus android"
        description: ""
       -category: 
       -tags: []
       +category: [android]
       +tags: [app, android]
        ---
               
       diff --git a/_posts/2015-03-24-grand-central-dispatch-tutorial-for-swift-part-2.md b/_posts/2015-03-24-grand-central-dispatch-tutorial-for-swift-part-2.md
       index 70aeb9d..a2d6cc8 100644
       --- a/_posts/2015-03-24-grand-central-dispatch-tutorial-for-swift-part-2.md
       +++ b/_posts/2015-03-24-grand-central-dispatch-tutorial-for-swift-part-2.md
       @@ -2,7 +2,7 @@
        layout: post
        title: "grand central dispatch tutorial for swift part 2"
        description: ""
       -category: 
       :
      
    4. --pretty=oneline

       $ git log --pretty=oneline -1
       ea33dbb2be5bc398a547181b2b23db664f63c31d refactor categories
      
       $ git log --pretty=oneline README.md
      
    5. --pretty=format:" "

       $ git log --pretty=format:"%h -%an, %ar : %s" -1
       ea33dbb -gree2, 31 hours ago : refactor categories
      
       $ git config alias.logs "log --pretty=format:'%h %an %ar %s'"
       $ git config alias.logs
       log --pretty=format:'%h %an %ar %s'
       $ git logs -1
       ea33dbb gree2 31 hours ago refactor categories
      
    6. --graph

  2. search by date author keyword

    1. --since=2.days

       $ git log --since=2.days -1
       commit ea33dbb2be5bc398a547181b2b23db664f63c31d
       Author: gree2 <hqlgree2@gmail.com>
       Date:   Thu Feb 4 15:47:59 2016 +0800
      
           refactor categories
      
    2. --author=gree2

       $ git log --author=gree2 -1
       commit ea33dbb2be5bc398a547181b2b23db664f63c31d
       Author: gree2 <hqlgree2@gmail.com>
       Date:   Thu Feb 4 15:47:59 2016 +0800
      
           refactor categories
      
    3. --grep=git

       $ git log --grep=git -1
       commit fe909cb6d08b3873c70e96dd40965bf39772d2f1
       Author: gree2 <hqlgree2@gmail.com>
       Date:   Thu Jan 14 17:17:35 2016 +0800
      
           create and apply a patch with git
      
    4. --committer=gree2

       $ git log --committer=gree2 -1
       commit ea33dbb2be5bc398a547181b2b23db664f63c31d
       Author: gree2 <hqlgree2@gmail.com>
       Date:   Thu Feb 4 15:47:59 2016 +0800
      
           refactor categories
      
    5. combine all together

       $ git log --since=2.days --author=gree2 --grep=git -1
      


blog comments powered by Disqus