0

I recently merged a pull request on GitHub with a merge commit, and it produced a merge commit as expected, but also added the commits from the branch, which we don't want. We were using the "Squash and merge" option before which only added one commit when merging the PR (as desired), but this meant it didn't appear as a merge in graphical git clients like GitKraken. A graphical representation:

How it is after merging with a merge commit:

develop ------ A ------ B ------------------------- C ----- D ----- E (merge commit)
                         -                         -
                          -                       -
                           feature ----- C ----- D

How I want it to be:

develop ------ A ------ B ------------------------- E (merge commit)
                         -                         -
                          -                       -
                           feature ----- C ----- D

Is it possible to get GitHub to only add one commit to the target branch when merging a PR and have this display as a merge in GitKraken?

See the repo for an example of what I mean. The 4 commits below the top commit were on the merged branch and shouldn't really be in develop (they correspond to C and D in the graphical example).

P.S All of the solutions from similar questions don't get the merge to appear correctly in GitKraken.

SamTebbs33
  • 5,507
  • 3
  • 22
  • 44
  • 1
    You might want to add a gitkraken tag to this question. For those of us unfamiliar with the software (like me)- its hard to tell how a solution would appear in the tool. Squashing is obviously the easiest method to get rid of the merge commit but its not what you want. – chevybow Apr 24 '19 at 19:17
  • That top graph is certainly not looking like any kind of normal merge result. Also, I use GitKraken daily, but with BitBucket and Azure DevOps. I've never seen it show a merge like that in those systems . – crashmstr Apr 24 '19 at 19:31
  • @crashmstr Please see my edit for the link to the commits in question. – SamTebbs33 Apr 24 '19 at 20:02
  • @SamTebbs33 I just cloned the repo and it looks normal to me for the merge of PR #9. Maybe it is something you are doing locally after the merge? [Imgur](https://i.imgur.com/LhYcvvW.png) – crashmstr Apr 25 '19 at 12:01
  • @crashmstr That does look correct in GitKraken, however if you look at the git log, you'll see the merge commit (27256ad) and also the commits that were on the feature branch (f58ac3e, 0637133, 9a2c657 and 1c9a9f0), and I'd rather just have one commit to cover all of these. In theory having lots of little commits for a merge rather than one bigger one would make bisecting take longer. – SamTebbs33 Apr 25 '19 at 12:55
  • @SamTebbs33 (Never mind, misread about the previously used squash did not look like a merge) That looks to be normal for a non fast-forward merge, otherwise the included commits in the merge would not show up in the log. If you also still have your branch locally, you might also be seeing those show up in `git log` as well, but I'm not sure. – crashmstr Apr 25 '19 at 13:09

0 Answers0