3

When I edit other peoples branches, all of my work is put under someone else's name. This not only is not helpful for me, but who ever looks at my code as they might be addressing the wrong person with fixes. I am aware that in git you can write

git commit -m "myFirstCommit" --author="Example Name <someone@example.com>"

And this does not even address my exact problem. So is there a way in SourceTree to change the author. If there is not a way, what would be the next best thing?

BJ Myers
  • 6,617
  • 6
  • 34
  • 50
user3339134
  • 65
  • 1
  • 2
  • 4
  • You can do it with command line using a combination of git interactive rebase and git commit --ammend. As shown in answer here http://stackoverflow.com/a/3042512/111489 – rangalo Jun 20 '14 at 14:56
  • Yeah @rangalo I saw that, but I was wondering if there was an easier way. Preferably in sourcetree! But if there is no way do you have to use --ammend can you do --author... or something simple like that where you only change the authors name? – user3339134 Jun 20 '14 at 15:08
  • This makes no sense. Git keeps track of a both the original author of a commit or a patch (the author field), and also the person who last modified the commit or patch (the commiter field). As far as I'm aware, Git never modifies the author field to be anyone other than the original author, so why would you want to change that manually? –  Jun 20 '14 at 18:24
  • See [Difference between author and committer in Git?](http://stackoverflow.com/q/18750808/456814). –  Jun 20 '14 at 18:25
  • Also, are you using SourceTree for Windows or OS X? It makes a difference, they don't share the same codebase, so their features will often differ from each other because they're on different development paths. –  Jun 20 '14 at 18:27
  • "*When I edit other peoples branches, all of my work is put under someone else's name.*" Why do you say that? What does `git log --format=fuller` say? –  Jun 22 '14 at 03:18
  • @Cupcake With interactive rebase I made sure the feature set was the same on Mac and Windows so you could do it from either – Kieran Senior Jun 23 '14 at 10:07

1 Answers1

1

As others have mentioned in the comments, you could use interactive rebase to do this. It's simply a matter of hitting the 'edit commit' (or was it amend? I forget). When SourceTree drops back out during the interactive rebase process to allow you to edit then you can re-commit hitting the 'amend commit' option in the commit view but changing the author from there instead. This actually creates a whole new commit SHA, too. Just hit 'continue rebase' from the "Repository" menu once you're done and it'll move you on to the next commit.

Cheers

Kieran Senior
  • 17,960
  • 26
  • 94
  • 138