4

Only on Xcode7.

And if I commit it by Terminal, everything goes well too.

~/.gitconfig file has never changed, since I update to Xcode7, the problem started.

The two name are all my name, authored name is my name in .gitconfig setting, committed name is my computer's name. And if I commit changes by Terminal, committed name won't appear. It just appeared on Xcode 7

It is so crazyI changed my computer account name just now, and commit again via Xcode7, the commit name turn to the same name but not disappear

enter image description here

Jie Li
  • 1,046
  • 11
  • 17

3 Answers3

5

I was having the exact same problem after upgrading to Xcode 7. I had my user.name and user.email set at the global level which worked fine for Xcode 6. I had to set those values at the repository level after upgrading (even though I use the same username and email for all of my repositories).

git config --local user.name "username"
git config --local user.email "my@email.com"
sunnymtn
  • 171
  • 3
  • Before I erase my disk and rebuild the system, I have tried this, but still not work. Now I have rebuild my system, it seems goes well. – Jie Li Sep 19 '15 at 03:09
2

Commits always have both a committer and an author, with each storing both a name and a time. In most cases, these are identical since you create the commit and commit it at the same time.

But it’s possible for them to be different, and there are various reasons why this can be:

  • Amending: This is probably the most common cause for different author and committer information. When you amend a commit using git commit --amend, you can fix the commit after it was made. The author data stays, but the committer data is refreshed.
  • Rebasing: When you rebase a commit, the author information stays the same, but the committer information is updated. So when you rebase your own commit, it will get a new commit time. When you rebase someone else’s commit, it will get a new commit name and time (but the author stays the same to show where it came from).
  • Applying patches: This is still a very common scenario. Someone submits a patch for example via email. The patch includes all the commit information including author and committer information. But when you apply the patch, you are overwriting the committer information with your own data since you just created the commit.
  • Intentionally setting the information: While rather exotic in nature, it is possible to impact what author and committer information is written to the commit before the commit is actually created. So someone could indeed create a commit with any information, for example to date-back a commit, or to attribute it to someone else.

In your case, since you have different authors, it’s likely that someone else rebased your commit. This is often done with pull requests on GitHub in order to avoid merges.

poke
  • 369,085
  • 72
  • 557
  • 602
  • Thank you for telling me so much :), but the two name are all my name, authored name is my .gitconfig name, committed name is my computer's username. And if I commit changes by Terminal, it won't appear. It just appeared on Xcode 7 – Jie Li Sep 18 '15 at 07:00
  • Your computer name? That’s super odd. – poke Sep 18 '15 at 07:02
  • Maybe the information in [this question helps](http://stackoverflow.com/questions/7812404/where-is-the-git-commit-info-set-in-xcode-4) – poke Sep 18 '15 at 07:03
  • It is crazyI changed my computer account name just now, and commit again via Xcode7, the commit name turn to the same name but not disappear...Thank you anyway – Jie Li Sep 18 '15 at 07:13
0

For global git init or setup:

git config --global user.name "username"
git config --global user.email "youremail@gmail.com"

For local repository git init or setup:

git config --local user.name "username"
git config --local user.email "youremail@gmail.com"
Victor
  • 2,450
  • 2
  • 23
  • 54