5

I rebased a coworkers branch that had 2 commits and squashed the second commit into the first one. It preserved the original author (i.e. not me).

Suppose I want to fix one line of code, so I reverse a hunk and make a new commit.

At this point, I'm back where I started, with two commits that I want to squash together, and want to preserve the original author. However, in the earlier case both commits had the same author. In this latter case, the commits being squashed have different authors. Which author will git assign to the new rebased/squashed commit?

Triynko
  • 18,766
  • 21
  • 107
  • 173
  • 1
    I also noticed that instead of making a new commit to reverse the changes, I can just do an ammend commit, and it preserves the original author. Still curious though, when squashing commits with multiple authors, how is the author determined? Is seems like it's whatever the author is of the commit you're squashing *into*, so if I squash a dozen commits by a dozen authors into a commit authored by "Joe", then "Joe" will be the author. This is really useful info, because I can organize other's people's commits (rebase, etc.) getting everything in line without messing with authorship. – Triynko Feb 12 '16 at 19:03
  • Your observation is accurate. The author remains the one whose commit you are squashing into. – progfan Jun 27 '16 at 04:49

1 Answers1

1

As noted in the comments, when doing a 'squash', the author remains the one whose commit you are squashing into.

Sean Houlihane
  • 1,698
  • 16
  • 22