Re: Reverting/cheout files with old modification date

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 09, 2011 at 07:09:47AM +0000, Peter Pientka wrote:
> Hi,
> Is any way to revert/checkout some files from reposotory with old modification
> date(file parameter). Now, while I revert/checkout some file, modification date
> of file is set to current date and time.
> 

I use this hook. On checkout it sets the mtime of all the files to
the date of the last commit touching them.

===== .git/hooks/post-checkout

#!/bin/sh

for f in `git ls-tree --name-only -r HEAD`; do
    mtime=`git log -n1 --date=iso --pretty=%ai -- $f`
    touch -m -d "$mtime" $f
done

=====


-- 
Fabrizio Chiarello <fabrizio.chiarello@xxxxxxxx>

You ask: what is the meaning or purpose of life? I can only answer with
another question: do you think we are wise enough to read God's mind?
  -- Freeman Dyson
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]