Git restore file date creation after clone on windows

I have my remote repository on win server 2003 and after cloninig project from etalon all dates of file creation became dates of cloning. This is OK, but I need to restore dates of creation for files as dates of the first file commit.
As I know there is some ways to use post-* scripts such as post-receive.
Main idea:

  1. receive files by git clone/pull

  2. Hide Plain Text Password in development.rb
  3. Git log: filter by commit's author date
  4. Gitignore file doesn't work as I want
  5. GIT Clones on Multiple Machines
  6. Difference between git fetch origin and git fetch ssh://originurl
  7. Broke my local git repo
  8. post-receive script modifyes file attributes (created/updated) according to the first file commit date for created and last file commit date for updated.

Any ideas how to write it (may be another way)?

  • Tool to find most recent commit that is changed by a previous change or change in workspace
  • GitLab: Can't push code to server?
  • How do I rename a Git repository created with gitolite?
  • How to create a Netbeans 7 project from an existing git repo?
  • non-interactive git squash/rebase all into current branch heads
  • Git commit -a error
  • 2 Solutions collect form web for “Git restore file date creation after clone on windows”

    Since you’re in Windows, this python script may help: for each file applies the timestamp of the most recent commit where the file was modified:

    • Core functionality, with –help, debug messages. Can be run anywhere within the work tree
    • Full-fledged beast, with lots of options. Supports any repository layout.

    Below is a really bare-bones version of the script. For actual usage I strongly suggest one of the more robust versions above:

    #!/usr/bin/env python
    # Bare-bones version. Current dir must be top-level of work tree.
    # Usage: git-restore-mtime-bare [pathspecs...]
    # By default update all files
    # Example: to only update only the README and files in ./doc:
    # git-restore-mtime-bare README doc
    import subprocess, shlex
    import sys, os.path
    filelist = set()
    for path in (sys.argv[1:] or [os.path.curdir]):
        if os.path.isfile(path) or os.path.islink(path):
        elif os.path.isdir(path):
            for root, subdirs, files in os.walk(path):
                if '.git' in subdirs:
                for file in files:
                    filelist.add(os.path.relpath(os.path.join(root, file)))
    mtime = 0
    gitobj = subprocess.Popen(shlex.split('git whatchanged --pretty=%at'),
    for line in gitobj.stdout:
        line = line.strip()
        if not line: continue
        if line.startswith(':'):
            file = line.split('\t')[-1]
            if file in filelist:
                #print mtime, file
                os.utime(file, (mtime, mtime))
            mtime = long(line)
        # All files done?
        if not filelist:


    file = line.split(‘\t’)[-1]

    should be changed:

    file = os.path.normpath(line.split(‘\t’)[-1])

    Because if you clone repository from linux to windows it will be different path separators and condition if file in filelist wil not work

    Git Baby is a git and github fan, let's start git clone.