Skip to content

Instantly share code, notes, and snippets.

@MaximRouiller
Last active August 23, 2022 15:36
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 MaximRouiller/026c90f66da4ab89ca9987ce0da8241e to your computer and use it in GitHub Desktop.
Save MaximRouiller/026c90f66da4ab89ca9987ce0da8241e to your computer and use it in GitHub Desktop.
Updates all the files modified date of a local clone of a git repository to reflect their actual last commit date
# Synchronously
git ls-tree -r --name-only HEAD | foreach { (Get-Item $_).LastWriteTime = [DateTime]::Parse("$(git log -1 --format="%ad" --date=iso8601 -- $_)") }
# Asynchronously
git ls-tree -r --name-only HEAD | ForEach-Object -Parallel { (Get-Item $_).LastWriteTime = [DateTime]::Parse("$(git log -1 --format="%ad" --date=iso8601 -- $_)") }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment