You might find yourself in a situation where you have to commit some code that has been authored by someone else. They might not have access to the repo, or they might be accustomed to Bazaar/SVN/Mercurial but not git, or maybe they're just on a 3 years vacation.
If you commit with the default global or project config, git will present you as the author.
You should not want that to happen for two reasons:
1- You might take credit for someone else's work and that's unethical.
2- You might take blame for their shitty code and that's bad.
For a new commit attributing another person, use this command:
git commit --author="Ms. Jane Codeldoe <Jane@Codeldoe.com>" -m "Jane wrote this I'm just committing"
For older commits, it's a bit more complicated, you want to avoid being in this kind of situations.
But, there are solutions, you just need to do some good old googling (or Binging, or Duckduckgoing, whatever suits you).
Solutions might vary depending on whether the commit is pushed to remote or not.
Solutions also vary depending on the git hosting service you're using, I've seen GitHub specific solutions that might not work elsewhere.
If you're stuck with this kind of problem, or any other problem you think I might be able to help solve, please contact me at
msalim [at] boun.cr . I'll be glad to help with my humble know-how.