Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to view modification history by git

Shulou Source: shulou.com Published: 2022-06-01 04:34:41 10月12日 Update

Git how to view the revision history, many novices are not very clear, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Git to view the modification history of the method: 1, the use of "git log-pretty=oneline file name" command to view the modification history of the specified file; 2, the use of "git show commit hash value" to view all the modified content of commit.

This article operating environment: Windows10 system, Git2.30.0 version, Dell G3 computer.

How does git view modification history

Sometimes when comparing the code, I see some changes, but I don't know the author and reason of the change, and I don't know the corresponding BUG number, that is to say, there is no way to find out the specific reason for these changes.

[note]: a file can be changed for a limited number of times, and each submission of code modification will be described by commit. We can start here.

Switch to the directory

First change to the directory where the file you want to view is located:

Cd packages/apps/Mms/src/com/android/mms/ui/

2. Git log-pretty

Then use the following command to list the history of all changes to the file. Note that here we focus on a specific file, not the git library. If it is a library, there are a lot of changes.

Git log-- pretty=oneline file name

III. Git show

As shown above, what is printed is the history of all the changes to the file MessageItem.java. The long string of numbers at the front of each line is the hash value formed by each submission, and then you can use git show to display the specific changes.

Is it helpful for git show 356f6def9d3fb7f3b9032ff5aa4b9110d4cca87e to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: File history clarity code content reason command that is file name directory switch help and then one line that is that is the author as above for this Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Tech Info Apple Huawei Shulou Information