Skip to content
mnaoumov.dev
Go back

git - change date of commit

git powershell

If you want for whatever reason change date of the existing commit you can use the following snippet (PowerShell)

If you want to modify date of the last commit

$commitDateString = "2010-01-01T14:30:00"
$env:GIT_COMMITTER_DATE = $commitDateString
git commit --amend --date $commitDateString
$env:GIT_COMMITTER_DATE = ""

For full list of supported date formats type

git commit --help

and look at DATE FORMATS section

If you need to change date of the non-last commit you would need to use interactive rebase first, select edit for those commits that should be changed and then apply approach shown above


Share this post on:

Previous Post
WTF Generic attributes in C_
Next Post
Sublime Text - The best text editor ever