If someone else wrote the code you are committing, you can give them credit with the
git commit -m "msg" --author "John Smith <email@example.com>"
You can also provide a pattern, which Git will use to search for previous authors:
git commit -m "msg" --author "John"
In this case, the author information from the most recent commit with an author containing "John" will be used.
On GitHub, commits made in either of the above ways will show a large author's thumbnail, with the committer's smaller and in front: