Skip to content

Instantly share code, notes, and snippets.

@arc279
Created May 20, 2019 05:33
Show Gist options
  • Select an option

  • Save arc279/2506153046f288eaf52c15eb5c98f0b6 to your computer and use it in GitHub Desktop.

Select an option

Save arc279/2506153046f288eaf52c15eb5c98f0b6 to your computer and use it in GitHub Desktop.
git管理のファイルのタイムスタンプをコミット日時に修正したい
#!/bin/bash
git ls-tree -rt --name-only HEAD | while read x; do
touch -t $(git log -1 --format=%ci "$x" | jq -r -R '. | strptime("%Y-%m-%d %H:%M:%S %z") | strftime("%Y%m%d%H%M.%S")') "$x"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment