1

I made a pull request for my feature branch to master. After my groupmate approved the pull request, in the commit history, it says both me and my groupmate made the changes.

In the code/repository view, it says "[me] and [groupmate] [commit message]".

This looks really bad because my commit message is "created and added ...", so it says "[me] and [groupmate] created and added ..."

The code/repository view's phrasing is problematic because I don't want to give our evaluator the impression that we did the feature together... I did it completely by myself.

In the more detailed commit view it says "[me] authored and [groupmate] committed ", which is much more acceptable.

Is this normal and what can I do to avoid any miscommunication with our evaluator?

Edit: I was able to reword the commits to make it clearer. For anyone having a similar problem, feel free to visit the hyperlink. I still want to know how to avoid this from happening.

hegerber
  • 201
  • 2
  • 13
  • Sounds like there was a cherry-pick involved (author is whoever developed it... committer is whoever cherry-picked it into that branch). No confusion in my mind, at least – eftshift0 Jun 14 '19 at 02:20
  • Did you request a review from your group mate on github? – Saurabh P Bhandari Jun 14 '19 at 02:41
  • You might want to look at this [question](https://stackoverflow.com/questions/18750808/difference-between-author-and-committer-in-git) ? – Saurabh P Bhandari Jun 14 '19 at 02:48
  • 1
    In my opinion, "Authoring" a commit has more value than just committing the changes (Linux kernel development is an exception though). This might hold good if your evaluator has a good understanding of git and github. – Saurabh P Bhandari Jun 14 '19 at 02:52
  • Possible duplicate of [Difference between author and committer in Git?](https://stackoverflow.com/questions/18750808/difference-between-author-and-committer-in-git) – Saurabh P Bhandari Jun 14 '19 at 11:46

1 Answers1

0

Git has the concept of both an author and a committer. This design goes back to the patch-based workflow of Linux and Git. The author is the person who wrote the patch, and the committer is the person who made the final commit. The committer may also have squashed the commit or made minor changes to it, such as to resolve conflicts or fix typos.

It sounds like what you're doing here is creating a squash commit. When you do that, the person merging the pull request is the committer, and the person who wrote the commits in the pull request is the author. This will be obvious in the more detailed view, but for brevity, GitHub will show only the two pictures in places where space is more limited.

If you don't want GitHub to list the merger of the pull request as the committer, then you need to not use the squash-and-merge functionality of GitHub; you should use the regular merge commit functionality instead. (Generally organizations that adopt this approach require a clean history and small, atomic commits.) There isn't any way to avoid this on GitHub, because GitHub produces commits that are consistent with the way that Git works, and your colleague made the commit.

The confusing commit message juxtaposed with the users can also be avoided if you follow Git's commit message guidelines and use the imperative mood. Your commits, even if squashed, will look like "[me] and [colleague] Create and add…", which will be less confusing.

bk2204
  • 64,793
  • 6
  • 84
  • 100