YouTip LogoYouTip

Git Show

# git show Command [![Image 3: Git Basic Operations](#)Git Basic Operations](#) * * * The `git show` command is used to display detailed information about Git objects. The `git show` command is used to view the content of commits, tags, tree objects, or other Git objects. This command is very useful for reviewing commit history, viewing specific commit content, and debugging Git objects. ### Basic Syntax git show [] [] * **``**: Specifies the Git object to display. It can be a commit hash, tag, branch name, etc. * **``**: Display options or format settings. **Common Options and Usage:** | **Option** | **Description** | **Usage Example** | | --- | --- | --- | | `--pretty=format:` | Customize output format. Use a format string to display commit information. | `git show --pretty=format:"%h %s" ` | | `--name-only` | Only display the names of changed files. | `git show --name-only ` | | `--name-status` | Display the names of changed files and their status (added, modified, deleted). | `git show --name-status ` | | `--stat` | Display commit statistics, including changed files, line counts, and file changes. | `git show --stat ` | | `--patch` | Display the diff patch of the commit (default behavior). | `git show --patch ` | | `--color` | Display colored output for better readability. | `git show --color ` | | `--no-patch` | Do not display the patch, only show commit information. | `git show --no-patch ` | | `--abbrev-commit` | Display shortened commit hash. | `git show --abbrev-commit ` | | `--pretty=oneline` | Display commit information in one-line format. | `git show --pretty=oneline ` | ### Common Usage **1、Display Detailed Commit Information** Display detailed commit information including commit message, author, date, and changed files: git show Example: git show 9a0d7b6 **2、Display Commit Diff** Only display the diff (patch) contained in the commit: git show --patch **Example:** git show --patch 9a0d7b6 **3、Display Commit File List** Only display the names of files changed in the commit: git show --name-only Example: git show --name-only 9a0d7b6 **4、Display Commit Statistics** Display commit statistics including changed files and line counts: git show --stat Example: git show --stat 9a0d7b6 **5、Display Commit Information with Custom Format** Use --pretty=
← Git Range DiffGit Notes β†’

YouTip © 2024-2026 | Home | Learn Technology, Build Dreams!

All content is for educational and learning purposes only.