I want to be able to do this for a script. I'm essentially re-creating the entire version history of some code in Git - it currently uses a different version control system. I need the script to be able to add in the commits to Git while preserving the commit's original author (and date).
Assuming I know the commit author and the date/time the change was made, is there a Git command that allows me to do this? I'm assuming there is, because git-p4 does something similar. I'm just asking for the best way to do it.
Check out the --author
option for git commit
:
From the man page:
--author=<author>
Override the commit author. Specify an explicit author using the standard
A U Thor <[email protected]>
format. Otherwise<author>
is assumed to be a pattern and is used to search for an existing commit by that author (i.e.rev-list --all -i --author=<author>
); the commit author is then copied from the first such commit found.