]> git.phdru.name Git - git-scripts.git/blob - hooks/post-checkout/set-last-commit-date-changed
4074707e4d5bc84e5dd7f00921a71c959e1b4b95
[git-scripts.git] / hooks / post-checkout / set-last-commit-date-changed
1 #!/bin/sh
2
3 # post-checkout hook that changes timestamps on changed files
4 # to that one of the last commit (head) if branch was changed
5
6 prev_HEAD="$1"
7 new_HEAD="$2"
8 new_branch="$3"
9
10 if [ "$new_branch" = 1 ]; then
11    commit_date="`git show --format='%cD' | head -1`" &&
12    touch --date="$commit_date" `git diff --name-only HEAD~`
13 fi
14
15 exit 0