考虑以下打字稿:
$ git clone git@github.com:laravel/framework.git
$ cd framework
$ git log --all --oneline --graph --decorate
...
| * | | | | | 07bb4d7 fix
| * | | | | | 0c2b7da Use the current timestamp as a default.
| * | | | | | 26cd65e (tag: v5.2.7) increment version
$ git show 0c2b7da
commit 0c2b7da2635f7bbbaf63d1b93fa817232bdd9d65
Author: Taylor Otwell <taylorotwell@gmail.com>
Date: Thu Jan 7 08:01:39 2016 -0600
Use the current timestamp as a default.
diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php
index fca8e89..7e179aa 100755
--- a/src/Illuminate/Database/Schema/Blueprint.php
+++ b/src/Illuminate/Database/Schema/Blueprint.php
@@ -791,9 +791,9 @@ class Blueprint
*/
public function timestamps()
{
- $this->timestamp('created_at');
+ $this->timestamp('created_at')->useCurrent();
- $this->timestamp('updated_at');
+ $this->timestamp('updated_at')->useCurrent();
}
/**
$ git log -p -m --full-history 07bb4d7 -Stimestamp src/Illuminate/Database/Schema/Blueprint.php
您在最后一个命令的输出中看不到此提交。但如果你这样做:
$ git log -p origin/master -Stimestamp src/Illuminate/Database/Schema/Blueprint.php
你会看到这一个:
commit 720a116897a4cc6780fa22f34d30c5986eafc581
Author: Taylor Otwell <taylorotwell@gmail.com>
Date: Wed Feb 3 08:13:22 2016 -0600
make timestamps nullable by default
diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php
index fca8e89..6cfab6f 100755
--- a/src/Illuminate/Database/Schema/Blueprint.php
+++ b/src/Illuminate/Database/Schema/Blueprint.php
@@ -779,9 +779,7 @@ class Blueprint
*/
public function nullableTimestamps()
{
- $this->timestamp('created_at')->nullable();
-
- $this->timestamp('updated_at')->nullable();
+ return $this->timestamps();
}
/**
@@ -791,9 +789,9 @@ class Blueprint
*/
public function timestamps()
{
- $this->timestamp('created_at');
+ $this->timestamp('created_at')->nullable();
- $this->timestamp('updated_at');
+ $this->timestamp('updated_at')->nullable();
}
/**
@@ -803,9 +801,9 @@ class Blueprint
*/
public function timestampsTz()
{
- $this->timestampTz('created_at');
+ $this->timestampTz('created_at')->nullable();
- $this->timestampTz('updated_at');
+ $this->timestampTz('updated_at')->nullable();
}
/**
我做错了什么?如何找到更改方法timestamps
的提交?
答案 0 :(得分:2)
来自the documentation for git log
(但我强调了):
htons(1<<i)==1<<(i^8)
查找更改文件中指定字符串的出现次数的差异(即添加/删除)。用于脚本编写者的使用。
在两个版本中(未更改之前和之后),未显示的提交在单词i
中具有相同的出现次数。该单词的实际使用不同,但出现次数是相同的。
显示 的提交会更改出现的次数:第一个diff-hunk用单词-S<string>
的一个副本替换单词timestamp
的两个副本(两个文字timestamp
字词被替换为一个timestamp
- 在字内 - timestamp
)。
你几乎肯定想要timestamp
标志,它在timestamps
标志的正下方描述。请注意-G
采用正则表达式而不是简单字符串,尽管单词-S
中没有正则表达式字符,因此对于这种情况没有区别。 (但您可能希望使用-G
来获取完整的Perl样式正则表达式,以便您可以搜索timestamp
,这意味着“单词时间戳但被非单词字符包围”,即“don” t匹配--perl-regexp
或\btimestamp\b
或timestamps
,所有包含 thetimestamp
。)