In git, I have two files with different commit date. But, when I make git-archive
, I get the same commit date, why ?
[[ -e git_test ]] && rm -rf git_test
mkdir git_test
cd git_test
git init
# make file01
echo 'f01 $Format:%cd$' > file01.txt
echo 'file01.txt export-subst' >> .gitattributes
git add .gitattributes file01.txt
git commit -m "adding file01"
sleep 1
# make file02
echo 'f02 $Format:%cd$' > file02.txt
echo 'file02.txt export-subst' >> .gitattributes
git add .gitattributes file02.txt
git commit -m "adding file02"
# git archive
git archive HEAD | tar -x -C ..
echo
echo "git log date"
git log --format="%cd" file01.txt
git log --format="%cd" file02.txt
echo
echo "git archive date"
cd ..
cat *.txt
in the output, with git-log
the commit date is different (one second), but the files generated with git-archive
have the same commit date
git log date
Fri Dec 27 15:17:22 2013 -0300
Fri Dec 27 15:17:23 2013 -0300
git archive date
f01 Fri Dec 27 15:17:23 2013 -0300
f02 Fri Dec 27 15:17:23 2013 -0300
I solved using
archive
only over the last modified filesthis way is only modified the commit date (and the file) over the last modified files.