Git Study Notes-view git history

Source: Internet
Author: User

Git learning notes-view git History 1. view Git logs: 2. specified search range: 3. view the differences between specified versions. 4. undo modify 4.1 Add modify (can only be used for the last commit) 4.2 reverse commit 4.3 reset 5 re-rewrite history 1. view Git logs: Command: git log does not add parameters by default. git logs display parameters from top to bottom based on the latest date: -p: display code differences between versions-submit the Digit Display Section-display the specified version with the hash value 2. specify the search range: -- since = "5 hours" shows the submission in the last five hours -- since = "5 hours"-1 shows the last submission in five hours -- before usage is similar to -- since usage, displays the submitted version 1 before a certain time point .. version 2 Description: all submissions from version 1 to version 2. Version 2 can use HEAD (in uppercase) to indicate the latest version ^ trace back to a version. Note: double quotation marks ("version ^" ~) must be added in windows "~ N: backtracking N versions 3. view the differences between the specified version git diff version Description: differences between the current directory tree and the corresponding version number git diff -- stat Description: count the number of code changes 4. undo modification 4.1 Add modification (can only be used for the last commit) git commit-c head-a -- amend4.2 reverse commit creates a new reverse commit to offset the original commit git revert-n HEAD reverse the latest commit of the current version library and cache it. But do not submit 4.3 reset git reset -- soft cache difference caused by reset but not commit, that is, reset to the status git reset before the previous commit -- hard Delete the commit example at the same time: git reset -- hard HEAD ^ reset to the version 5 before the HEAD. When do I need to rewrite the history? Reorder history records multiple commits are merged into one commit into multiple commits git rebase-I HEAD ~ 3. In essence, it uses the variable base operation to locate the scope you want to change. Then go to the editor to modify the part you want to modify. Then return to the current ending point.

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.