How to copy commit metadata (author, date) from another commit

Viewed 851

I'm sure there is a way to do this in git, but my searches are coming up empty. Is there an easy way to get the message, commit author, commit date and other info from one commit and amend the second commit with this data, without copying the actual commit contents?

2 Answers

You can use the -c flag:

$ git commit --amend --no-edit -c <other commit hash>
git commit --amend --reuse-message=<source commit hash>
Related