← Back to Git Course | Chapter 2: Basic Commands | Lesson 13 of 18

Git show Command

git show album में एक photo खोलकर उसे closely देखने जैसा है: यह बताता है किसने ली, कब, caption, और इसमें exactly क्या बदला।
Syntax
bash
git show [commit_hash]
git show commit_hash:file_name

Last Commit दिखाना

बिना arguments के git show आपकी सबसे हाल की commit के बारे में सब कुछ दिखाता है -- author, date, पूरा message, और exact patch (line-by-line code changes) जो इसने introduce किया -- एक combined view में।

उदाहरण: Showing the Last Commit

bash
git show

एक Specific Commit दिखाना

एक specific commit hash या tag name pass करना, जैसे git show a1b2c3d, आपको अपने project की history में किसी भी point को same तरीके से inspect करने देता है, सिर्फ latest commit नहीं।

उदाहरण: Showing a Specific Commit

bash
git show a1b2c3d

एक Specific Commit पर एक File दिखाना

git show <commit>:<path/to/file> एक file के exact contents print करता है जैसे वे उस specific commit पर existed थे, बिना उस commit को checkout किए या आपकी current branch या working files को बिल्कुल भी disturb किए।

उदाहरण: Showing a File at a Specific Commit

bash
git show a1b2c3d:path/to/file.txt

Output Format Customize करना

अगर आपको सिर्फ इसकी परवाह है कि कौन सी files बदलीं बजाय पूरे line-by-line patch के, git show --stat detailed diff को प्रति file insertion/deletion counts के एक compact summary से swap कर देता है।

उदाहरण: Customizing the Output Format

bash
git show --stat

File Names और Status दिखाना

git show --name-only और भी आगे जाता है, सिर्फ उन filenames को list करते हुए जो उस commit में add, modify, या delete हुईं -- actual changes में जाने से पहले किसी commit के scope पर एक quick glance के लिए उपयोगी।

उदाहरण: Showing File Names and Status

bash
git show --name-only
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. git show चलाना और working directory changes की उम्मीद करना, जबकि यह एक committed snapshot और उसका diff दिखाता है।
  2. एक hash का सिर्फ इतना छोटा या ambiguous हिस्सा pass करना, ताकि Git एक ambiguous argument report करे।
  3. git show a1b2c3d:file.txt में colon भूल जाना, ताकि Git file.txt को file के contents दिखाने के बजाय एक अलग path माने।

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.