Skip to content

Instantly share code, notes, and snippets.

@techtonik
Created July 9, 2017 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techtonik/341bceb75c551520c0b69184948564ee to your computer and use it in GitHub Desktop.
Save techtonik/341bceb75c551520c0b69184948564ee to your computer and use it in GitHub Desktop.
Commit file versions using their timestamps as commit date
import os
from shellrun import run
from datetime import datetime
hist = sorted([name for name in os.listdir('.') if name.startswith('appvey') and name != 'appvey.py'])
print('\n'.join(hist))
for f in hist:
tstamp = datetime.fromtimestamp(os.path.getmtime(f))
run('copy {} appvey.py'.format(f))
run('git add appvey.py')
run('git commit -m "hacking.." --date "{}"'.format(tstamp))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment