4

I am working on a project with git version control. It has many contributors. In the first few days of the project, many commits were made without an author. I read this post, and this one too. I have tried going through git rebase -i <Original commit SHA> but all of the commits I flag with an edit tag have merge conflicts to address! I looked into calling rerere to use the old fixes, but because rerere changes are cached and I had not originally set it to true in gitconfig, it's not an option here.

Short of going commit-by-commit and readdressing the merge conflicts, what can I do to change the authors for those early commits?

Community
  • 1
  • 1
broguinn
  • 49
  • 3
  • If you're doing a rebase that involves merge commits, why aren't you using the `--preserve-merges` flag? –  May 18 '14 at 17:14
  • 1
    For merges to show up in rabase command we, need to add `-r` or `rebase-merges`. Then we get knee-deep in some merge-conflicts somewhere again ! – KRoy Apr 01 '20 at 03:14

2 Answers2

1

The posts your reference mention rebase -i, but also git filter-branch.

You should try the git filter_branch approach, which doesn't re-apply each commits, and doesn't have to resolve merge conflicts.

Like the rebase, that will change your history, though, and you will have to push --force the end result.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

I think you will help this parameter --author. So if yo have merge commit already just whrite:

git commit --amend --author="Foo Bar <foo@example.com>"
gurugray
  • 67
  • 2