Reputation: 913
I have a repo with two branches: master
and fix-tests
. Remotely, I've already created a PR and did a Squash and Merge on fix-tests so that all of the changes from fix-tests are in master. That's all fine and good. But, when I have fix-tests checked out and do a git show
it says:
Author: jsmith <[email protected]>
But, when I have master checked out and do a git-show
it says:
Author: John Smith <[email protected]>
Why is the author name for the first one (on fix-tests) my username while on master it's the full name? This is causing problems while trying to send commit info to Slack.
Any and all help would be appreciated. Thanks!
Upvotes: 1
Views: 749
Reputation: 75565
If you are using the GitHub GUI to Squash and Merge, then GitHub is taking your commits and creating a new commit out of them.
When it does this, it collects the author name and author email information from your GitHub account, which is presumably set to John Smith
and not jsmith
.
If you want to work around this, you can either update your name in GitHub
, or do the squash and merge manually on the command line.
An additional alternative is to use Schwern's answer and update your name locally to be consistent with the one on GitHub.
Upvotes: 2
Reputation: 164819
The most likely reason is that you're making commits from different accounts and they are configured slightly differently. And "squash and merge" is a commit.
If you committed via your own machine, and did the "squash and merge" via Github, then likely your Git configuration on your machine has a different name for you than your Github account. Likely your machine used your login name by default, jsmith
whereas Github got your full name when you signed up, John Smith
. You can check with git config user.name
.
To fix it, set your name on any accounts you use to make commits to match what's on Github.
git config --global user.name 'John Smith'
Upvotes: 1