Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Viewing Changes | More Advanced Interaction
Git Essentials

bookViewing Changes

git log -p

The git log command displays the commit history of a project. To view the exact lines changed in each commit, use the -p (patch) flag. This approach is helpful when you need to quickly identify a commit that introduced a bug in the code.

Full command:

Run the command in the terminal:

Git log -p

Each commit is separated by a frame of different colors to improve visual distinction. Because the detailed information about each commit may not fit on one screen, use the arrow keys to scroll up and down.

Note
Note

You can exit pressing the q key.

Here, plus signs indicate added lines, and if any lines were deleted, they would appear with minus (dash) symbols.

git show

The git show command displays detailed information about the changes introduced by a specific commit. Basic syntax:

git show [commit]

Here, [commit] refers to the hash (identifier) of the commit you want to view.

Examine the output of the git log -p command, focusing on the second latest commit:

Here are the first few lines of the output for this commit. To use the git show command for this commit, copy its hash and run the following command:

Note
Note

Your commit hash may be different, so be sure to use the correct hash.

Run this command in the terminal:

Git show

As you can see, the output is the same as for the git log -p command, but only for one commit.

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 2

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

What does the output of `git log -p` look like?

How do I find the commit hash for a specific change?

Can you explain the difference between `git log -p` and `git show`?

Awesome!

Completion rate improved to 3.57

bookViewing Changes

Swipe to show menu

git log -p

The git log command displays the commit history of a project. To view the exact lines changed in each commit, use the -p (patch) flag. This approach is helpful when you need to quickly identify a commit that introduced a bug in the code.

Full command:

Run the command in the terminal:

Git log -p

Each commit is separated by a frame of different colors to improve visual distinction. Because the detailed information about each commit may not fit on one screen, use the arrow keys to scroll up and down.

Note
Note

You can exit pressing the q key.

Here, plus signs indicate added lines, and if any lines were deleted, they would appear with minus (dash) symbols.

git show

The git show command displays detailed information about the changes introduced by a specific commit. Basic syntax:

git show [commit]

Here, [commit] refers to the hash (identifier) of the commit you want to view.

Examine the output of the git log -p command, focusing on the second latest commit:

Here are the first few lines of the output for this commit. To use the git show command for this commit, copy its hash and run the following command:

Note
Note

Your commit hash may be different, so be sure to use the correct hash.

Run this command in the terminal:

Git show

As you can see, the output is the same as for the git log -p command, but only for one commit.

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 2
some-alt