View git History commands and git internal objects

Source: Internet
Author: User

View git history

 

Git log [branch]/[commit hash]/[tag]Displays a summary of Historical submission information for a branch, commit, or tag.

Git log a .. BDisplay historical information in a-B Evolution

 Add the parameter-P to view the detailed modification information.

Git show [branch]/[commit hash]/[tag]Display details of the last submission

The variable head indicates the Branch currently being processed. If it is a multi-channel merge head ^ n tableThe Nth ancestor, head ~ N indicates the ancestor of the N generation

Git grep "keyword" [branch]/[commit hash]/[tag]Filter and find the corresponding keywords. Various options of grep are supported.

 

Git Object Database

 

Git uses four types of objects to manage the system

Git cat-file can be used to view corresponding files,-T is used to list object types, and-P is used to print objects

You can use git show to obtain the 160-bit hash value, which indicates a commit object.

    • The commit object will point to a tree object, that is, the image of the tree directory of the current node in the history; it will also point to the parent commit to establish an association with the previous commit.
    • The tree object is used to display the status of a directory. The tree object contains blob objects and subdirectory objects.
    • Blob objects contain file data.
    • The head of each branch is stored in. Git/refs/heads. At the same time, the headers of the current branch are stored in. Git/head.

 

Git index file

 

For the role of the index file, see the other two documents. for reference:

 

Located in./git/index. You can use the command git LS-files -- stage to view the hash list. Use Git-catfile to view the hash list and get the latest modification.

Therefore, the role of git add is to create a blob file to record the latest changes.CodeAnd add a link to this blob in index file.

 

 

 

 

 

 

 

 

 

 

 

 

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.