git log usage "go"

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/gbyukg/archive/2011/12/12/2285419.html

PHP Technology Group 170855791

Git log view commit record, parameters:
- N (n is a positive integer) to view the last N commit information

$ git log-2    see the last 2 commit history

--filename filename for any file name to view the submission information for the specified file. ( Note: The file name should be placed at the last position of the parameter, usually preceded by--separated by a space to indicate the file.) )

$ git log file1 file2   view commit record for File1 file File2 file
$ git log file/ view commit records for all files under the file folder

--branchname branchname for any branch name, view the commit record on Mo branch. As above, it needs to be placed at the last position in the parameter. (Note: If the branch name is the same as the file name, you will be prompted with an error, the--option to specify whether the given parameter is a branch name or a file name .) Example: There is a file named V1 in the current branch, and there is a branch named V1:

$ git Log v1-v1 represents the branch name at this time
$ git log--V1 at this point, V1 represents a file named V1.
$ git log v1--V1

tagname or branchame query the commit record information in the specified label/branch

$ git log v1.0.        Query the Commit history from v1.0 (not including v1.0)
$ git log test: Master queries the commit record in the master branch but does not contain the test branch record
$ git log master: Test queries the commit record in the test branch but does not include the master branch record
$ git log master...test queries the commit record in the master or Test branch.
$ git log test--not Master Block Master Branch

Query log according to commit

$ git log commit  queries the record before commit, including commit
$ git log commit1 commit2 queries the records between COMMIT1 and Commit2, including Commit1 and Commit2
$ git log commit1..commit2 ibid, but not including commit1

Where commit can be a shorthand mode for committing hashes, or you can use head instead. The HEAD represents the last commit, and head^ is the last committed parent, equivalent to the Head~1,head~2 delegate's second penultimate submission
--pretty
Displays the log information in the specified format, with the options: Oneline,short,medium,full,fuller,email,raw and Format:<string>, and medium by default, You can modify the configuration file to specify the default
Way.

$ git log (--pretty=) oneline

Common format options:

Option     Description
%H Full hash string for commit object (commit)
%h A short hash string for the Commit object
full hash string for%T tree object
Short hash string for%t tree object
the full hash string of the parent object (%P)
%p A short hash string for the parent object
the name of the%an author (author)
%ae Author's e-mail address
%ad Author Revision date (can be customized with-date= option)
%ar Author revision date, by how long before the way display
%CN The name of the submitter (committer)
%ce The submitter's e-mail address
%CD Date of submission
%CR submission Date, as of how long ago the way it appears
%s Submission Instructions

Note: The author refers to the person who last modified the document, and the submitter refers to the person who submitted the document.

$ git log--pretty=format: "%an%ae%ad%cn%ce%cd%cr%s"--graph

--mergs View all the merged commit history

--no-merges View all submissions that have not been merged

--author=someonet Query the submission record for the specified author

$ git log--author=gbyukg

--since,--affter Only show commits after a specified time (not including the current date)

--until,--before Show only commits before the specified time (contains the current date)

$ git log--before={3,weeks,ago}--after={2010-04-18}

--grep Filtering the submission log by submitting the description information

$ git log--grep=hotfix This command will list all the submission records that contain the description of the submission for the hotfix word

Note: If you want to use both--grep and--author, you must attach a--all-match parameter.

- S retrieves the specified commit log by querying the change contents of the file Note: the-S does not have a "=", and there is no space between the contents of the query

$ git log--snew

- P View patch information at commit

$ git log-p--no-merges-2

--stat List the number of modified rows for a file

--sortstat only displays the last number of rows in--stat Modify add removed statistics

--graph list submission records in a simple graphical way

--abbrev-commit displays only the first few characters of the SHA-1, not all 40 characters.

--relative-date uses a shorter relative time display (for example, "2 weeks Ago").

--name-only Displays the modified list of files only after the information is submitted.

--name-status Displays a list of new, modified, and deleted files.

GIT Blame
To view each part of the file modification details

$git Blame index.php

git log usage "go"

Related Article

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.