git log

Use git log command , Without any parameters , All logs will be output in the following format ( My current git The warehouse has only three submissions ). If there are too many logs , stay git bash in , Press the down button to see more , Press q Key to exit viewing log .

$ git log
commit c08099d1cf05fdc541752b049a91b92bdcf78a12
Author: zdk <zdk@menhoo.com>
Date: Mon Jun 19 23:08:07 2017 +0800 add hello.txt to git rep commit 723687a41685667a01dbd6254eb148d19501c3f1
Author: zdk <zdk@menhoo.com>
Date: Sun Jun 18 22:27:29 2017 +0800 add c.txt commit 1a29bde9519195f14e98270c29d125e9d18b8d87
Author: zdk <zdk@menhoo.com>
Date: Sun Jun 11 22:40:21 2017 +0800 Added a.txt and b.txt file
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

git log –oneline

--oneline Parameter to output each log as a line , If there are more logs , Using this parameter can make the result look more eye-catching . In order to save the journal space , I will also use this parameter frequently later .

$ git log --oneline
c08099d add hello.txt to git rep
723687a add c.txt
1a29bde Added a.txt and b.txt file
  • 1
  • 2
  • 3
  • 4

git log -[length]

-[length] Parameter is used to specify how many logs to display

$ git log --oneline -2
c08099d add hello.txt to git rep
723687a add c.txt
  • 1
  • 2
  • 3

It uses -2 To specify that the first two logs are displayed

git log –skip=[skip]

--skip=[skip] Parameter is used to specify to skip the previous logs . The following commands are used to view the second and third logs

$ git log --skip=1 -2 --oneline
723687a add c.txt
1a29bde Added a.txt and b.txt file
  • 1
  • 2
  • 3

git log –pretty=raw

I used it many times --oneline It's to save space , Make the article look as neat as possible . and --pretty=raw More information about each submission is displayed

$ git log --pretty=raw -1
commit c08099d1cf05fdc541752b049a91b92bdcf78a12
tree 5ef6cd7051101c4294cb92980f0cf3740478e120
parent 723687a41685667a01dbd6254eb148d19501c3f1
author zdk <zdk@menhoo.com> 1497884887 +0800
committer zdk <zdk@menhoo.com> 1497884887 +0800 add hello.txt to git rep
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

The output includes submission ID, File tree ID, Father submitted ID, Authors and authors , This information is very useful .

git log -p

-p The parameters will output more information , Used to display the change records submitted , It's equivalent to using it many times git show [commit_id] Result .

$ git log -1 -p
commit c08099d1cf05fdc541752b049a91b92bdcf78a12
Author: zdk <zdk@menhoo.com>
Date: Mon Jun 19 23:08:07 2017 +0800 add hello.txt to git rep diff --git a/hello.txt b/hello.txt
new file mode 100644
index 0000000..ce01362
--- /dev/null
+++ b/hello.txt
@@ -0,0 +1 @@
+hello
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

git log –graph

--graph The parameter draws the submitted thread , If there's a merger , And it will be more clearly displayed

$ git log --graph --oneline
* c08099d add hello.txt to git rep
* 723687a add c.txt
* 1a29bde Added a.txt and b.txt file
  • 1
  • 2
  • 3
  • 4

git log –decorate

--decorate Parameters are used to display some relevant information , Such as HEAD、 Branch name 、tag Name and grade

$ git log --decorate --oneline
c08099d (HEAD -> master) add hello.txt to git rep
723687a add c.txt
1a29bde Added a.txt and b.txt file
  • 1
  • 2
  • 3
  • 4

Use git tag The order adds a name to the second submission important Of tag.

git tag 'important' 723687a
  • 1

Then use it again --decorate Parameters to see

$ git log --decorate --oneline
c08099d (HEAD -> master) add hello.txt to git rep
723687a (tag: important) add c.txt
1a29bde Added a.txt and b.txt file
  • 1
  • 2
  • 3
  • 4

It shows tag Information about .

git log –name-status

--name-status Parameter will bring out the corresponding file changes for each submission .

$ git log --name-status --oneline
c08099d add hello.txt to git rep
A hello.txt
723687a add c.txt
A c.txt
1a29bde Added a.txt and b.txt file
A a.txt
A b.txt
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

Search for git journal

Search by author

Sometimes I look at myself from the submission record ( Or someone ) Some submission of ,git log Commands can quickly retrieve this information

$ git log --author yourname
  • 1

You can screen out yourname All logs submitted by users . there yourname You can include wildcards , from Author: zdk <zdk@menhoo.com> The matching information in the information .

Search by submitting keywords

$ git log --grep keywords
  • 1

You can grab the matching... From the submitted keywords commit term .

Search by filename

occasionally , We want to check all the modification records of a file , You can filter the submission only related to this file according to the file name , You can use -p Parameters

git log -p -- RELEASE-NOTE.md
  • 1

Be careful , This -- Followed by the relative address of the full file name , It's not fuzzy matching . If the relative address of your file is config/my.config Words , You need to use the following command

git log -p -- config/my.config
  • 1

By combining --authergrep-p These parameters , It can almost meet most of the retrieval needs .

git log More related articles on common usage of

  1. 4. git log Common usage of

    git log ====== see https://blog.csdn.net/daguanjia11/article/details/73823617 +++++++++++++++++++++++ Use ...

  2. git log View the modification history of a file

    Enter the directory where this file is located 1. git log --help be-all git Orders can be made through git manual see stay synopsis You can see the formula in  git log [<options>] ...

  3. [ turn ] console.log Advanced usage of

    // Basic usage console.log(' Most common use \n Line break '); console.error(' Output error message It will show in red '); console.warn(' Print warning messages It will show in yellow '); cons ...

  4. console.log Advanced usage of

    // Basic usage console.log(' Most common use \n Line break '); console.error(' Output error message It will show in red '); console.warn(' Print warning messages It will show in yellow '); cons ...

  5. Git commit Common use

        Git commit git commit It's mainly about passing users through git add The changes that the command adds to the scratch pad are submitted to the local version library , For the composition of the version library, see my previous notes . Every time we submit it, we will generate it in the local version library ...

  6. git Introduction to common usage

    1. git help: help git help xxx git xxx --help 2. git init: initialization git init 3. git config: To configure Common use git config ...

  7. git log usage 【 turn 】

    from :http://www.cnblogs.com/gbyukg/archive/2011/12/12/2285419.html PHP Technology exchange group  170855791 git log View submission records , ginseng ...

  8. Git log Advanced usage

    format Log Output First , This article will show several git log Examples of formatted output . Most of the examples are just marked to git log Request more or less information . If you don't like the default git log Format , You can use it. git config ...

  9. git log Advanced usage

    from :https://github.com/geeeeeeeeek/git-recipes/wiki/5.3-Git-log%E9%AB%98%E7%BA%A7%E7%94%A8%E6%B3%95 Inside ...

Random recommendation

  1. Comet Server push and SignalR

        HTTP Protocol is a typical Request/Response agreement , Is based on TCP/IP An application layer protocol above , The most typical characteristic of this protocol is that it is stateless and needs to be initiated by the client Request Only the server can carry out Response, ...

  2. 【BZOJ1003】1003: [ZJOI2006] Logistics transportation trans SPFA+DP

    Description The logistics company is going to take a batch of goods from the dock A To the dock B. Because of the large quantity of goods , need n Genius can finish . In the process of cargo transportation, there are usually several docks to be stopped . Logistics companies usually design a fixed transportation route , In order to implement strict control over the whole transportation process ...

  3. sql Merge duplicate row data into one row , The data is separated by commas

    One . Define table variables DECLARE @T1 table ( UserID int , UserName ), CityName ) ); ,'a',' Shanghai ') ,'b',' Beijing ') ,'c',' Shanghai ') ...

  4. ASP.NET The use of six validation controls

    C# There are six validation controls in :1 CompareValidator: Compare and verify , Whether the values of the two fields are equal , For example, judge whether the password entered by the user is consistent with the confirmation password , You can change the control with : 2 CustomValidator ...

  5. Android Practical code seven ( 3、 ... and )

    Preface Finally, I saved another article , This series is mainly practical , Welcome to share and recommend easy to use code snippets with me ~~ Statement Welcome to reprint , But please keep the original source of the article :)  Blog Garden :http://www.cnblogs.com Uncle farmer : http: ...

  6. ListView Use —— Chat window

    One . step 1. stay layout Create two layouts , They are their own answers , And the other person's response . 2. establish ChatMessage This class , Member variables have avatar addresses . Chat content . Type ( hypothesis 1 It means the other party ,2 Express oneself ). 3. establish C ...

  7. utilize an instrument MailUtils Realize the sending of mail , The big hole I met , High energy warning !!

    java The implementation of e-mail sending depends on jar The bag has two :mail.jar and activation.jar, I also found a kit :itcast-tools-1.4.jar, Implementation principle, you can see the source code , Let out the resource link first h ...

  8. HTML conditional comments

    In front of the word IE The conditional note is Microsoft from IE5 A kind of nonstandard logic statement provided at the beginning , The function is to be flexible for different IE Version browser import is different html Elements . Obviously, the biggest advantage of this method is that it belongs to the compatible solution provided by Microsoft, and it can also pass through W ...

  9. GANs A review of

    GANs The first one is familiar with , No introduction . Look at the variants . 1) LAPGANs: The pyramid , Gradually optimize the image generation (Deep Generative Image Models using Lapalacian Pyramid ...

  10. 2018 Spring competition of Northeast Agricultural University C-wyh Business opportunities for

    One day , You wyh Seniors and you zhl Seniors play a game , This is the rule of the game Here you are. n Cities , Make sure that n There is only one way to get to each city . There's one thing , It's the same in all cities , But because the economic development of each city is different , Lead to ...