Claude Code for Product Designers
Lesson 26 of 49, 0 of 49 lessons completed
Sign in
Watch on YouTubePlay

Plays from YouTube. Google's privacy policy (opens in a new tab) applies.

Up next

2.12 Two tasks at once

Next lesson in 8 s

2.11 Three ways to merge

Adam explains GitHub's three ways to merge a pull request (merge commit, squash and merge, rebase and merge) and why he prefers squash, then squash-merges his first PR by hand on GitHub.

What you'll learn

  1. GitHub offers three ways to merge a PR; teams differ in which they use.
  2. Create a merge commit (GitHub's default): all the branch's commits stay in main's history, plus a commit saying the branch was merged.
  3. Squash and merge: all commits become one on main ("we added My bookings"); the detail stays on the feature branch.
  4. Rebase and merge: the commits appear as if made on main directly; the branch's existence is lost from history.
  5. For a tidy history, squash and merge.
  6. If you just ask Claude to "merge the PR", it may choose the default; put your preference in the shared CLAUDE.md, or restrict merge types in GitHub's repo settings.
  7. The squash confirmation screen lets you edit the commit title and extended description.

Chapters

  1. 00:00Merge commit, GitHub's default
  2. 02:10Squash and merge
  3. 03:31Rebase and merge
  4. 05:01Choosing your team's merge type
  5. 06:35Squash-merging your first PR
  1. 00:01Okay, designers. Well, the time has come to merge this PR once and for all.
  2. 00:08But you didn't think it's going to be that easy now, did you?
  3. 00:12It is easy, of course, but I think it's important for us to like just quickly skim through the three ways to do it.
  4. 00:19we are going to use just one way but I think you know it it helps to know that there are three ways basically to do it because you know
  5. 00:26depending on uh you know what kind of engineering team you'll end up working with uh you might see you know different strategies uh for merging PRs okay so let's
  6. 00:35just really quickly skim over those okay um so the first kind of PR and I think the one that GitHub uh will uh present to you as the default
  7. 00:46one is called emerge merge uh PR.
  8. 00:50Is it merge PR?
  9. 00:51No, it's a merge commit PR.
  10. 00:53Okay. So, what we do is we basically like all of the comments which we just did, right?
  11. 00:58uh the ones about um you know the fixes and you know the refinements and everything along the way it all gets like saved within this history of the main
  12. 01:11branch along with one new information about like hey this is where we decided to take this branch and merge it with the new one.
  13. 01:18Okay. So like further down the line if you want to go go back to like the history uh you will find basically uh a trace of every single thing
  14. 01:29you did when you were working on that PR and you know if you are really attached about like to your work and uh you it's it's really important for
  15. 01:38for you and for the entire world to see just how much effort you have put into like making that my bookings view come alive.
  16. 01:47that might be an option for you because this way all of the commits are you know preserved along like with the history of the main branch along with the
  17. 01:56information that uh you know at some point these commits were part of a different branch and they were just merged into this one.
  18. 02:03Okay. So if we were if we were to actually do this kind of a merge that graph which we had in clot code it would look exactly like this.
  19. 02:11There would be that additional line.
  20. 02:12Okay. There is a second version.
  21. 02:15It's called squash and merge.
  22. 02:18And I've just realized it's I I think it's impossible to say the word squash and not do this gesture with your hand.
  23. 02:25So it's the squash and merge.
  24. 02:27So how is this different from the merge commit PR?
  25. 02:31So squash and merge will basically take all of your commits and is going to squash them into just one.
  26. 02:38So that you know whoever is looking at the history of commits or just the history of the main branch the only thing that this person is going to see
  27. 02:46is that at this point in time we've just added the my bookings view but this person unless you know unless they are going to deliberately switch into that feature
  28. 02:54branch which we've been working on.
  29. 02:57They are not going to learn about the fact that you know we did some sort of simplification pass um that we did refine the my viewing my viewing my
  30. 03:07my my [laughter] bookings empty states at some point and that this wasn't part of the first implementation you know that too many can be considered noise.
  31. 03:17So a squash and merge is a perfect way to cut away the noise and just preserve the only thing that matters which is hey at this point in time
  32. 03:26we just rolled out the my bookings view.
  33. 03:28Okay. And then there's the third way which is uh it's the rebase and merge.
  34. 03:35So rebase and merge.
  35. 03:37What it does is um it's going to take all of your commits which we did uh as part of this branch and it's going to rebase them so that
  36. 03:46they appear as they were made on the main branch and the history or that the fact about the branch you know existing is sort of lost.
  37. 03:54Okay. So it's going to look like as as if we were just committing directly to the main branch from the very beginning.
  38. 04:01And this is going to again preserve all of the information about the work we did like you know the fact that we did again the empty states refinements or
  39. 04:10that we did simplification pass.
  40. 04:12So it's really similar to the first one except on the first one you know with the um with the merge commit we are going to preserve the fact that
  41. 04:21this work once lived on a different branch.
  42. 04:25So if like keeping up your work and like everything that you did along the way is important to you, consider one or two, preferably one.
  43. 04:34But what I'm going to go with and I what I would recommend and I believe this might be a little bit of a consensus or although maybe I shouldn't
  44. 04:43go really that far.
  45. 04:44If you really care about like having a like a tidy version history, I think you should consider the squash.
  46. 04:51I'm sorry, the squash and merge.
  47. 04:54Okay, so we are going to do the squash and merge commit.
  48. 04:57Now there are a couple of ways of to do it.
  49. 04:59Of course, um as with everything you can either go back to GitHub, okay, open up this PR and you can scroll down over here and over here where it
  50. 05:08says merge pull request, you can open this up to see all of the three options to merge a PR which we've just discussed, right?
  51. 05:16And you can see that this by like by default it's going to create that merge commit.
  52. 05:20Okay, merge commit again being uh being this.
  53. 05:24This is the merge commit.
  54. 05:26What I want to do is I want to do squash and merge.
  55. 05:30Now, if I were to go back to claude and ask it to um ask it to merge the PR.
  56. 05:37Oh, it even suggests uh uh this as the next message.
  57. 05:42You know, truth be told, I have no idea what Claude is going to do.
  58. 05:45Uh but I have um I I suspect it's going to go with also the merge commit option.
  59. 05:52Okay. Uh if you want your clot to always do squash and merges, this is something you would want to input in your CLAUDE.md file, the one that uh
  60. 06:02gets shared with everyone else in your main uh in your main project folder.
  61. 06:09So this CLAUDE.md file, right?
  62. 06:10this is the right place for you to uh have this information about you know hey in this repo we prefer the squash and merge.
  63. 06:20There is also an option on GitHub in your repo settings to set it up so that you basically have no other option to do a squash and merge.
  64. 06:28Okay, if you really want to go uh like allin uh that would be probably an option for you.
  65. 06:35So are we going to ask CL or are we going to do it ourselves?
  66. 06:38Of course, we're going to do it ourselves because this is the first PR and I think it's important to, you know, uh, witness this firsthand, like the the feeling
  67. 06:47and the the sensation of merging your first PR manually on GitHub.
  68. 06:53So, I hope you're with me right now as I'm going to open up this drop down.
  69. 06:57I'm going to select the squash and merge.
  70. 07:00I'm going to take a deep breath in.
  71. 07:06[snorts] For the last time, I'm going to do this with my hand.
  72. 07:10As I click and I do squash and mer.
  73. 07:13Okay, there is a confirmation screen.
  74. 07:16Uh, you can add some sort of descriptions.
  75. 07:18Basically, this is going to this is how your comment message is going to look like.
  76. 07:22So, a comment message can have a title and then it has it also has a body or extended description in that in that uh particular example.
  77. 07:30Um so basically what we are now uh describing or setting up is how this commit is going to look like.
  78. 07:37Okay. Um and I'm just going to go with the defaults.
  79. 07:40So again I'm going to do this with my hemp and I'm going to do confirm squash and merge.
  80. 07:51Okay. Hopefully my internet doesn't break right now.
  81. 07:54That would be really bummer.
  82. 07:56that would really ruin all of the like this dramatic ending and it appears this is going to be the case here.
  83. 08:03Uh such an unfortunate turn of events.
  84. 08:09Well, in our imagination we can imagine like that this internet connection is flawless and that in a second we are going to see a confirmation message of our PR
  85. 08:20being successfully merged. Or maybe I'll just use the magic of editing.
  86. 08:26Just like that. Okay.
  87. 08:28And we have like officially merged our PR.
  88. 08:31Congratulations. Congratulations. Uh okay.
  89. 08:34I'll see you in the next lesson in which we are going to step it up a little.

The cheat sheet is for signed-in viewers. Inside: the lesson's prompts ready to reuse, the commands and shortcuts, useful links and what to watch out for.

Sign in to get the cheat sheet

Loading the cheat sheet…