EDIT:概要:GIT中不允许日期之前在其 “内部日期格式”(从epoch秒)给出的1973年3月3日9点46分四十秒(划时代+ 100000000s)。这是允许“20110224”作为“2011-02-24”的简称。 - 这不是问题:不是,但它也没有记录。 - 解决方法:不能依赖git内部日期。 - 感谢:霍布斯
大家好,
我有一些问题,用git过滤分支,我已经找到了到git的承诺树。考虑一下这个脚本:
#!/bin/bash
# please run these commands in an empty directory
# (should not destroy an existing repo, though. I think it would only
# a few dangling objects)
set -e -o pipefail
git init
tree=$(git write-tree)
commit=$(echo "my first commit -- the tree is empty" |
env GIT_AUTHOR_DATE="0 +0000" git commit-tree $tree)
echo "This is commit $commit:"
git cat-file commit $commit
注意,env GIT_AUTHOR_DATE="0 +0000"
组使用“Git的内部格式”日 - 请查看git提交树的联机帮助页详情 - 1970-01-01。
但这个脚本的输出(原始提交)是
tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
author Jane Doe <jane> 1298477214 +0100
committer Jane Doe <jane> 1298477214 +0100
my first commit -- the tree is empty
现在为什么混帐忽略$ GIT_AUTHOR_DATE?如果这意义重大,我的git --version
给出git version 1.7.1
。
优秀赶上! – Arrowmaster 2011-02-23 17:46:07
哇,我希望我可以多次赞扬这个。你想怎样才能检查这个? – 2011-02-23 20:56:33
@Adrian我没有看到文档中的任何内容,并且我已经检出了git源代码...所以我开始进行grepping。有时候RTFS会比任何事情都更快地陷入问题的核心:) – hobbs 2011-02-23 21:29:43