문제
에서 gitfaq 나는 그것을 읽을 수있다
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
이제 내 질문 : Git이 파일의 타임 스탬프를 변경 한 이유 fileb
? 타임 스탬프가 변경되지 않기를 기대합니다.
내 명령이 문제를 일으키고 있습니까?
어쩌면 A와 같은 일을 할 수 있습니다 git checkout . --modified
대신에?
나는 사용 중입니다 git version 1.6.5.1.1367.gcd48
Mingw32/Windows XP에 따라
해결책
Linux 파일 시스템에서는 발생하지 않습니다. 설명한 정확한 시나리오를 테스트했으며 수정 시간이 손대지 않은 파일에 대해 보존됩니다.
sean@SEAN-PC:~/Desktop/test$ ls -la tests/BusTests.*
-r--r--r-- 1 sean sean 8 2010-02-11 11:53 tests/BusTests.c
-r--r--r-- 1 sean sean 1 2010-02-11 11:51 tests/BusTests.h
sean@SEAN-PC:~/Desktop/test$ git status -a
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: tests/BusTests.c
#
sean@SEAN-PC:~/Desktop/test$ git checkout .
sean@SEAN-PC:~/Desktop/test$ ls -la tests/BusTests.*
-r--r--r-- 1 sean sean 1 2010-02-11 11:55 tests/BusTests.c
-r--r--r-- 1 sean sean 1 2010-02-11 11:51 tests/BusTests.h
나는 이것이 Mingw32 Git 빌드에서 알려지지 않은 버그라고 생각합니다. 개발자에게보고 할 수 있습니다. http://code.google.com/p/msysgit/issues/list
수정 된 파일 만 확인할 때 Bustests.h 수정 스탬프가 수정되었는지 확인하는 것은 흥미로울 것입니다.
git checkout -- tests/BusTests.c
다른 팁
git ls-files -m | xargs git co --
수정 된 파일 만 확인하는 데 도움이됩니다. 그러나 나는 여전히 설명 할 수 없습니다 git checkout
문제가 발생합니다.
MSYSGIT 버전 1.7.0.2에서 GIT 재설정과 비슷한 문제를 발견했습니다. 이전에는 수정 된 파일의 타임 스탬프 만 변경합니다. 이제 모든 파일의 타임 스탬프를 변경합니다. 이 문제가 없기 때문에 1.6.5.1을 사용하는 것으로 돌아갔습니다. :)