How Can I See the Changes in a Git Commit?
This platform also permits Git users to commit changes and maintain the history of commits in the log, which helps the user to see recent changes and revert changes.
This blog will demonstrate how to see the Git commit changes.
How Can I See the Git Commit Changes?
To see the Git commit changes, first, make a new commit using the “git commit -m” command. For this purpose, check out the given procedure.
Step 1: Launch Git Terminal
Firstly, launch the “Git bash” Git terminal from the Startup menu:
Step 2: Change the Git Local Repository
Next, utilize the “cd” command to change the Git local repository:
Step 3: Make a New File
Create a new file that will later be committed for modification:
Step 4: Add File to Staging Environment
Next, add the newly untracked file to the staging environment using the mentioned command:
Check the Git repository status to verify whether the file is added to the staging area or not:
It can be observed that the file is added to the staging area and is ready to commit changes:
Step 5: Commit Changes
Next, commit the file from the staging area using the below-provided command. Here, the “-m” flag is used to embed the message along the commit:
Step 6: See Changes in Git Commit
See the Git commit changes by checking the Git log. To do so, run the “git log” command:
The below output shows the recent changes in a Git commit and verifies that the new commit is successfully done:
Alternatively, use the “git log –raw” command to see the details of the updates as well:
Here you go! You have learned how to see the changes in a Git commit.
Conclusion
To see changes in the Git commit, open the Git local repository. Next, create a new file and add it to a staging environment. After that, commit the staged file using the “$ git commit -m” command. Next, to see the Git commit changes, utilize the “$ git log” command. This post has taught you how to see changes in a Git commit.
Source: linuxhint.com