4

我刚刚进入 VC,尤其是 git。我知道基本命令,git add/commit/remote但很难理解输出:

$ git show f27d852

commit f27d852fc750a9c3f71eaf0acf586164b76faddf
Author: myusername <myemail@gmail.com>
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;
+       }

每条线是什么意思?如何阅读它。谁能解释一下?

谢谢dk

4

2 回答 2

5
commit f27d852fc750a9c3f71eaf0acf586164b76faddf

提交的 sha1。

Author: myusername <myemail@gmail.com>

作者的姓名和电子邮件,可能与提交者的姓名和电子邮件不同。

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

作者日期,可能与提交者日期不同。

changed color to a different color

提交日志消息。它可以是一行,也可以是第一部分 + 空行 + 另一部分。空行之前的唯一行或第一部分是subject,空行之后的另一部分是body

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

已比较的两个文件。

index bbd44d7..ee1765e 100644

bbd44d7是更改前 blobee1765e的 sha1 和更改后 blob 的 sha1。您可以运行git show <blob-sha1>git cat-file -p <blob-sha1>查看 blob 的内容。

--- 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;
+       }

194是差异起始行,5是上下文行。footer p {指示差异部分的位置。没有前缀 + 或 - 的行是未更改的行。如果添加一行,则为 +。如果删除一行,则为 -。如果你修改一行,它是一个 - 和一个 +。

于 2016-07-03T15:03:25.207 回答
1

它提供了有关提交的详细信息,然后提供了已更改文件及其差异的列表(有关详细信息,请参阅统一差异):

# commit id:
commit f27d852fc750a9c3f71eaf0acf586164b76faddf
# author:
Author: myusername <myemail@gmail.com>
# 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
于 2016-07-02T11:07:45.730 回答