Git Tutorial View Submit history Details _ Related Tips

Source: Internet
Author: User

Git View Submit History

After a few updates have been submitted with git, or if a project is cloned, and you want to review the submission history, we can view it using the git log command.
For our previous chapter, use the git log command to list the history submission records as follows:

$ git log
commit 88afe0e02adcdfea6844bb627de97da21eb10af1
merge:14b4dca d7e7346
Author:w3cschool < W3c@w3cschool.cc>
Date:  Sun Mar 1 15:03:42 2015 +0800

  Merge Branch ' change_site '
  
  Conflicts:
    Test.txt

commit 14b4dcadbdc847207651d5a9fae0d315057f346e
author:w3cschool <w3c@w3cschool.cc>
Date:  Sun Mar 1 14:53:15 2015 +0800

  New line

commit d7e734640da06055e107eaf29cf350b3f1de1c2c
Author:w3cschool <w3c@w3cschool.cc>
Date:  Sun Mar 1 14:48:57 2015 +0800

  changed the site

commit 556f0a0637978097b82287ac665a717623b21f3f
author:w3cschool <w3c@w3cschool.cc>
Date:  Sun Mar 1 14:40:34 2015 +0800

  removed test2.txt

We can use the--oneline option to view a concise version of the history.

$ git log--oneline
88afe0e Merge branch ' change_site '
14b4dca new row
d7e7346 changed the site
556f0a0 rem Oved test2.txt
2e082b7 Add test2.txt
048598f add test.txt
85fc7e7 test Comment from w3cschool.cc

What this tells us is the history of the development of this project.

We can also use the--graph option to see when a branch or merge occurred in history. The following are the same commands, and the topology options are turned on:

$ git log--oneline--graph
*  88afe0e Merge branch ' change_site '
|\ 
| * d7e7346 changed the site
* | 14B4DCA new Add line
|/ 
* 556f0a0 removed test2.txt
* 2e082b7 add test2.txt
* 048598f add test.txt
* 85 Fc7e7 Test Comment from w3cschool.cc

Now we can see more clearly when work is forked and when it is merged.

You can also use the '--reverse ' parameter to reverse the display of all the logs.

$ git log--reverse--oneline
85fc7e7 test comment from w3cschool.cc
048598f add test.txt
2e082b7 add test2.tx T
556f0a0 removed test2.txt
d7e7346 changed the site
14B4DCA add a new line 88afe0e
Merge branch ' Change_site '

If you only want to find the submission log for a specific user, you can use the command: Git log--author, for example, we are looking for the part of the GIT source Linus submission:

$ git log--author=linus--oneline-5
81b50f3 move ' builtin-* ' to a ' builtin/' subdirectory
3bb7256 make ' Inde X-pack "A built-in
377d027 make" git pack-redundant "a built-in
b532581 make" git unpack-file "a built-in
1 12dd51 make "Mktag" a built-in

If you want to specify a date, you can perform several options:--since and--before, but you can also use--until and--after.

For example, if I were to look at all submissions three weeks ago and after April 18 in a Git project, I could do this (I also used the--no-merges option to hide the merge submissions):

$ git log--oneline--before={3.weeks.ago}--after={2010-04-18}--no-merges
5469e2d git 1.7.1-rc2
Documentation/remote-helpers:fix typos and improve language 272a36b Fixup:second argument May is any
arbitrary strin G
b6c8d2d documentation/remote-helpers:add invocation section
5ce4f4e documentation/urls:rewrite to Accomodate transport::address
00b84e9 documentation/remote-helpers:rewrite description
03aa87e  Documentation:describe situations where-z affects git diff 77bc694 rebase-interactive:silence when
no Commits rewritten
636DB2C t3301:add tests to use--format= "%N"

More git log commands can be viewed: http://git-scm.com/docs/git-log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.