Skip to content

Instantly share code, notes, and snippets.

@ratik
Created July 14, 2015 11:07
Show Gist options
  • Save ratik/75aeb9128eb3947cd5cb to your computer and use it in GitHub Desktop.
Save ratik/75aeb9128eb3947cd5cb to your computer and use it in GitHub Desktop.
set date from last commit for files pulled from git
#!/usr/bin/env bash
last_date=`git log --date=iso | head -n 3 | grep Date | sed 's/.*e: //i'`
for changed in `git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD`;
do
touch $changed -c -d "$last_date"
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment