Home > Article > Development Tools > How to view modification history in git
How to view the modification history in git: 1. Use the "git log --pretty=oneline file name" command to view the modification history of the specified file; 2. Use "git show commit hash value" to view all modifications of the commit Content.
The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.
How to check the modification history in git
Sometimes when comparing codes, you see certain changes, but you don’t know the author of the changes and the reason, and I don’t know the corresponding BUG number, which means that the specific reasons for these changes cannot be found~
[Note]: A certain file can be changed a limited number of times, and each time the code is modified Submissions will have a commit description, we can start from here;
1. Switch to the directory
First switch 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 all the change history of the file. Note that this focuses on a specific file, not the git library. If it is a library, there will be many changes. ~
git log --pretty=oneline 文件名
The example is as follows:
3. git show
As shown above, what is printed is for the file MessageItem.java For all the change history, the long string of numbers at the front of each line is the hash value formed by each submission. Then use git show to display the specific changes of a certain change~
git show 356f6def9d3fb7f3b9032ff5aa4b9110d4cca87e
The results are as follows:
Recommended learning: "Git Tutorial"
The above is the detailed content of How to view modification history in git. For more information, please follow other related articles on the PHP Chinese website!