6

I have a number of commits on github that look like this:

enter image description here

Is there a way of rebasing so that I can get rid of this and simply have the commit marked as by me?

Mohan
  • 7,302
  • 5
  • 32
  • 55
  • FWIW, I think the problem was caused by using a slightly different v. of my name on two different computers. That or updating my email. – Mohan Dec 01 '16 at 15:07

2 Answers2

4

First I would check that your git is configured with the correct user information. Run git config --list to verify that everything is correct.

You can also try playing with interactive rebasing to edit a commit.

  1. Enter interactive rebase git rebase -i <commit ID>
  2. Change the commit you want to change to edit, save and exit
  3. Recommit with a different author git commit --amend --author="Author Name <email@address.com>
Jake Henningsgaard
  • 704
  • 1
  • 6
  • 16
2

Similar to Question Change commit author at one specific commit.

With only a few commits you can manually do:

  1. git rebase --root -i to rebase everything from current HEAD to its root.
  2. change the lines for all commits to edit
  3. The rebase starts now at the first commit
  4. Amend current commit: git commit --amend --author "Name <email>"
  5. Continue the rebase: git rebase --continue
  6. Repeat steps 4 & 5 until all commits are through

"Name <email>" has to be your wished name and email of course.

With more than a few commits this manual approach might get cumbersome.

PS: This messes up your repo-history, because the author information is included when generating the sha-hash for the commit. So do this with care. Next time set up your user.name and user.email properly.

Community
  • 1
  • 1
johannesmik
  • 731
  • 1
  • 8
  • 18