This is probably an extremely simple question but I'm trying to modify the date of a Git commit but whenever I try to modify the Git environment variables GIT_COMMITTER_DATE
or GIT_AUTHOR_DATE
I get this message.
When I type git var -l
they don't show up either.
Do I have to add those variables myself?
C:\Users\MolinaBA\Desktop\MCPInfoGitMigrationTest>GIT_COMMITTER_DATE="12/12/12 4:40p +0000" git commit --amend --no-edit
'GIT_COMMITTER_DATE' is not recognized as an internal or external command,
operable program or batch file.
You need to first set
the GIT_COMMITTER_DATE
variable and then try git commit --amend
. Shown below:
> set GIT_COMMITTER_DATE="12/12/12 4:40p +0000"
> git commit --amend --no-edit
Similar step for GIT_AUTHOR_DATE
.
> set GIT_AUTHOR_DATE="12/12/12 4:40p +0000"
If you are not using bash, you can set the variable just for this command with:
cmd /v /c "set GIT_COMMITTER_DATE=12/12/12 4:40p +0000&& git commit --amend --no-edit"
Note the lack of space before the &&
. That is important or the value would have an extra space.
That way, you don't have to unset those variables once you are done using them got the commit --amend
.
If you use the other answer, at least unset those variables:
set GIT_COMMITTER_DATE=
set GIT_AUTHOR_DATE=
Or any other git commit
would use those dates!
But with the cmd /v /c "..."
, you limit the variable to that command. It does not persist in your CMD session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With