Skip to content

Instantly share code, notes, and snippets.

@tw-Frey
Last active September 10, 2021 04:07
Show Gist options
  • Select an option

  • Save tw-Frey/347e9259dafcd7829c4c3248b7e6f1d5 to your computer and use it in GitHub Desktop.

Select an option

Save tw-Frey/347e9259dafcd7829c4c3248b7e6f1d5 to your computer and use it in GitHub Desktop.
git amend commit and let author date and commit date that both are the same.
@setlocal
@if not [%1]==[] if not [%1]==[--] (
set GIT_AUTHOR_DATE=%1
set GIT_COMMITTER_DATE=%1
set git_date_params=--date=%1
)
@if not [%2]==[] if not [%3]==[] (
set GIT_AUTHOR_NAME=%2
set GIT_AUTHOR_EMAIL=%3
set GIT_COMMITTER_NAME=%2
set GIT_COMMITTER_EMAIL=%3
set git_author_params=--author="%2 <%3>"
)
git commit --amend --no-edit %git_date_params% %git_author_params%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment