Home  >  Article  >  Development Tools  >  How to view commit modifications in git

How to view commit modifications in git

WBOY
WBOYOriginal
2022-06-30 16:53:1019203browse

How to view commit modifications in git: 1. Use "git log" to print all commit records and obtain the commitid of the commit that needs to be viewed; 2. Use the "git show commitIdfile" command to view the modifications; 3. Use " "git show commitId fileName" to view the modifications of a specific file in a commit.

How to view commit modifications in git

The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.

How to view commit modifications in git

Specific steps:

1. First, you need to print all commit records through git log

Find the one you want to view The commitid of the commit.

How to view commit modifications in git

2. Check the changes.

git show commitIdfile

How to view commit modifications in git

3. Check the modification of a specific file in a commit:

git show commitId fileName

Expand knowledge:

Sometimes we find that the code that was originally online has been modified, or our own code has been overwritten. We need to know who did the operation and what modifications were made. This article will introduce how git views the submission record and the modification content of a certain submission

win logo key R, enter cmd to open the command line. (If git cannot be used on the cmd command line, please open Git Bash)

Enter the project root directory

Enter git log and press Enter

Each submission is output in the command line Record

Recommended study: "Git Tutorial"

The above is the detailed content of How to view commit modifications in git. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn