git-show:tldr:7138e
The git show
command is used to display and review various forms of Git objects such as commits, tags, and trees. It shows the metadata and content changes associated with the specified object.
The general syntax of the git show
command is:
git show [object]
Here, [object]
represents the object you want to view. It can be a commit hash, tag name, or branch name.
When you run the git show
command, it displays the following information for the specified object:
- Commit Details: It shows the commit hash, author, date, and commit message.
- Changes: It displays the diff or patch-type output, highlighting the differences made in the commit. The changes can include additions, deletions, and modifications to files.
- Metadata: It shows any associated metadata, such as the commit parent(s) or tree.
git show
can also be used with various options to modify the output format or display specific information. Here are some commonly used options:
-s
or--no-patch
: Shows only the commit details without the changes.--stat
: Provides a summarized view of changes, displaying the files modified and the number of lines added/deleted.--oneline
: Shortens the commit details to a one-line summary.--name-only
or--name-status
: Shows only the names of the files modified or displays the modified files with a status indicator (e.g., M for modified, D for deleted).
Overall, git show
is a useful command to inspect the specific details and content changes associated with Git objects, helping you review and understand the history of your repository.