[操作]
1. Install git on windows 7
2. Init a respo
3. Add a new text file name "a.txt" and commit
4. Copy a.txt to another folder:
4.1 Change one word in txt file, keep the same file size
4.2 Change file time stamp to original
5. Copy updated a.txt back to the git respo just created
6. Check use command "git status" or "git diff"
结果:Git不会发现任何差异。
我的期望是git能够找到文件的差异。 我想知道原因和如何解决?
附注: 1.如果步骤4.1、4.2在respo文件夹中操作,git可以找到文件更改。 2.如果时间戳设置为未来的日期,git也可以正常运行。
[示例命令]
Set PATH=%PATH%;D:\Git\bin
git init Test
cd Test
echo 123456 > a.txt
D:\XXX\FILETIME.exe a.txt 09/29/2016 12:12:12
git add .
git commit -m "init a.txt"
echo 654321 > a.txt
D:\XXX\FILETIME.exe a.txt 09/29/2016 12:12:12
git status
git diff
[日志]
C:\>git init Test
Initialized empty Git repository in C:/Test/.git/
C:\>cd Test
C:\Test>echo 123456 > a.txt
C:\Test>D:\xxx\FILETIME.exe a.txt 09/29/2016 12:12:12
a.txt
Creation time ... 09/29/2016 12:12:12
Last access time ... 09/29/2016 12:12:12
Last write time ... 09/29/2016 12:12:12
C:\Test>git add .
C:\Test>git commit -m "init a.txt"
[master (root-commit) 95f91e5] init a.txt
1 file changed, 1 insertion(+)
create mode 100644 a.txt
C:\Test>echo 654321 > a.txt
C:\Test>D:\xxx\FILETIME.exe a.txt 09/29/2016 12:12:12
a.txt
Creation time ... 09/29/2016 12:12:12
Last access time ... 09/29/2016 12:12:12
Last write time ... 09/29/2016 12:12:12
C:\Test>git status
On branch master
nothing to commit, working tree clean
C:\Test>git diff