dkjain
dkjain

Reputation: 871

how to read git show command output

I am just getting into VC and in particular git. I am aware of basic commands like git add/commit/remote but having a hard time understanding the output:

$ git show f27d852

commit f27d852fc750a9c3f71eaf0acf586164b76faddf
Author: myusername <[email protected]>
Date:   Tue Jun 28 22:59:35 2016 +0530

    changed color to a different color

diff --git a/css/business-casual.css b/css/business-casual.css
index bbd44d7..ee1765e 100644
--- a/css/business-casual.css
+++ b/css/business-casual.css
@@ -194,5 +194,5 @@ footer p {
 /* CUSTOM CSS - BY ME */

 .brand {
-       color: #ff0000;
-       }
\ No newline at end of file
+       color: #ffdd000;
+       }

What does each line mean? How to read it. can anyone explain?

Thanks dk

Upvotes: 7

Views: 3478

Answers (2)

ElpieKay
ElpieKay

Reputation: 30858

commit f27d852fc750a9c3f71eaf0acf586164b76faddf

The sha1 of the commit.

Author: myusername <[email protected]>

The author's name and email, which might be different from the committer's name and email.

Date:   Tue Jun 28 22:59:35 2016 +0530

The author date, which might be different from the committer date.

changed color to a different color

The commit log message. It could be one line, or the first part + empty line(s) + the other part. The only line or the first part before the empty line(s) is subject, and the other part after the empty line(s) is body.

diff --git a/css/business-casual.css b/css/business-casual.css

The two files that have been compared.

index bbd44d7..ee1765e 100644

bbd44d7 is the sha1 of the blob before the change and ee1765e the sha1 of the blob after the change. You could run git show <blob-sha1> or git cat-file -p <blob-sha1> to see the blob's content.

--- a/css/business-casual.css

The file before the change.

+++ b/css/business-casual.css

The file after the change.

    @@ -194,5 +194,5 @@ footer p {
 /* CUSTOM CSS - BY ME */

 .brand {
-       color: #ff0000;
-       }
\ No newline at end of file
+       color: #ffdd000;
+       }

194 is the diff start line and 5 is the context lines. footer p { indicates where the diff part locates. The lines without prefixing + or - are unchanged lines. If you add one line, it's a +. If you delete a line, it's a -. If you modify a line, it's a - and a +.

Upvotes: 10

Zbynek Vyskovsky - kvr000
Zbynek Vyskovsky - kvr000

Reputation: 18825

It provides the details about commit and then list of changed files with its differencies (see unified diff for details):

# commit id:
commit f27d852fc750a9c3f71eaf0acf586164b76faddf
# author:
Author: myusername <[email protected]>
# date committed:
Date:   Tue Jun 28 22:59:35 2016 +0530
# commit message:
    changed color to a different color
# difference for css/business-casual.css :
diff --git a/css/business-casual.css b/css/business-casual.css

Upvotes: 2

Related Questions