的Git將當前時間作爲每次修改文件的時間戳,但只有那些。
不過,我想這個命令序列(編輯:添加完整的命令序列)
$ git init test && cd test
Initialized empty Git repository in d:/test/.git/
$ touch filea fileb
$ git add .
$ git commit -m "first commit"
[master (root-commit) fcaf171] first commit
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 filea
create mode 100644 fileb
$ ls -l > filea
$ touch fileb -t 200912301000
$ ls -l
total 1
-rw-r--r-- 1 exxxxxxx Administ 132 Feb 12 18:36 filea
-rw-r--r-- 1 exxxxxxx Administ 0 Dec 30 10:00 fileb
$ git status -a
warning: LF will be replaced by CRLF in filea
# On branch master
warning: LF will be replaced by CRLF in filea
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: filea
#
$ git checkout .
$ ls -l
total 0
-rw-r--r-- 1 exxxxxxx Administ 0 Feb 12 18:36 filea
-rw-r--r-- 1 exxxxxxx Administ 0 Feb 12 18:36 fileb
現在我的問題:沒有混帳爲什麼要改變文件fileb
的時間戳?我希望時間戳保持不變。
我的命令是否會導致問題?
也許有可能改爲像git checkout . --modified
那樣做?
我在mingw32/windows xp下使用git version 1.6.5.1.1367.gcd48
。
感謝您的努力,'git checkout - tests/BusTests.c'按預期工作。 – tanascius 2010-02-11 14:17:57
我爲我的問題添加了一個完整的命令序列......也許你可以嘗試再次重現這一點? – tanascius 2010-02-12 17:52:54