{"thread":{"id":"57249","subject":"`git commit` with the `--author` option","startedAt":"2022-01-14T20:25:11Z","lastAt":"2022-01-14T20:38:36Z","messageCount":2,"participants":["Glen Peterson","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"446246","messageId":"CA+LnoU=MwKiyY6+MUWUj=SpgGrg2RVabNY_vtBbBicAsW2ZzjA@mail.gmail.com","threadId":"57249","inReplyTo":null,"subject":"`git commit` with the `--author` option","fromName":"Glen Peterson","fromEmail":"glen.k.peterson@gmail.com","sentAt":"2022-01-14T20:24:58Z","receivedAt":"2022-01-14T20:25:11Z","isPatch":false,"sender":{"key":"glen.k.peterson@gmail.com","avatar":null},"body":"Thank you for git!  I use it hourly.  It is orders of magnitude better\nthan vcs, cvs, subversion, clearquest, sourcesafe, and a number of\nothers I have used, but can't remember right now.\n\nI was excited to see the `--author` option on the `git commit`\ncommand, thinking that I could use it to set arbitrary authors for git\ncommits.  Reading the docs, I expected to use it to, \"Specify an\nexplicit author using the standard A U Thor _author@example.com_\nformat.\"\n\nIt seems from stackoverflow and this list that git won't do that\nunless you have an author specified in your config somewhere (`git\nconfig user.email` and `git config user.name`)?  Links to sources\navailable on request (your system rejected my first email).\n\nDoes the email you set in the `--author` option have to match the one\nin your config, or can you set it to anything once you have a random\nuser.email in your config?  Is this option just for choosing between\npre-configured emails?\n\nI think this option would be much more useful if it worked without\nalso setting your git config.\n"},{"id":"446247","messageId":"YeHfRguxRI6wNwvg@camp.crustytoothpaste.net","threadId":"57249","inReplyTo":"CA+LnoU=MwKiyY6+MUWUj=SpgGrg2RVabNY_vtBbBicAsW2ZzjA@mail.gmail.com","subject":"Re: `git commit` with the `--author` option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2022-01-14T20:38:30Z","receivedAt":"2022-01-14T20:38:36Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Hey,\n\nOn 2022-01-14 at 20:24:58, Glen Peterson wrote:\n> Thank you for git!  I use it hourly.  It is orders of magnitude better\n> than vcs, cvs, subversion, clearquest, sourcesafe, and a number of\n> others I have used, but can't remember right now.\n\nI'm glad you're happy with it.  We always like to hear good news.\n\n> I was excited to see the `--author` option on the `git commit`\n> command, thinking that I could use it to set arbitrary authors for git\n> commits.  Reading the docs, I expected to use it to, \"Specify an\n> explicit author using the standard A U Thor _author@example.com_\n> format.\"\n> \n> It seems from stackoverflow and this list that git won't do that\n> unless you have an author specified in your config somewhere (`git\n> config user.email` and `git config user.name`)?  Links to sources\n> available on request (your system rejected my first email).\n> \n> Does the email you set in the `--author` option have to match the one\n> in your config, or can you set it to anything once you have a random\n> user.email in your config?  Is this option just for choosing between\n> pre-configured emails?\n\nThe --author option does set the author, and it should contain a\npersonal name and email in the typical format.  It can contain any entry\nyou want, whether or not it's set in the config, provided it meets the\nsyntax requirement.\n\n> I think this option would be much more useful if it worked without\n> also setting your git config.\n\nCreating a commit also requires that you specify a committer.  Since\nthere's no option for that, you'll need to either have it come from the\nconfig, or use the GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL\nenvironment variables to specify the committer information.  There are\nsimilar GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL, which are useful to set if\nyou're working in a script.\n\nYou can also use the -c option to specify that config, like so:\n\n  git -c committer.name=\"Pat Doe\" -c committer.email=\"doe@example.com\" commit\n\nThere are even more ways you can get this information, and the\ngit-commit(1) manual page outlines them in detail.  If you think that\ndocumentation is lacking, please let us know, and I'll try to get an\nimprovement in when I next get a chance.\n\nI agree that a --committer option would also be a nice improvement here,\nthough, since this seems to be a thing people want, especially for\nscripting.  If there are other use cases you're thinking of that aren't\nscripting related or that we haven't considered, please share more, and\nwe'll see if we can accommodate them.\n-- \nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"}]}