3

I have made 6 commits on a GitHub branch completely online and I need to squash them into 1 commit. Is there a button for me to do this? I've only made the commits on the GitHub website so is there a way to do this without using the command line?

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Erika
  • 235
  • 4
  • 12

2 Answers2

4

When merging, instead of just clicking the "Merge pull request" button, click the drop down menu and select "Squash and merge" option (second option down):

enter image description here

Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • Thanks for your help so far! However I am trying to merge into another repository, not my own. Do you have any idea how to go about this? – Erika Dec 02 '17 at 18:36
2

It seems you can't merge your commits purely with GitHub (I did a brief search on Google, there seems no introduction with it), but you can squash your commits during merging. In your question says on a GitHub branch completely online, it seems that you are holding a second branch on GitHub. Then, while you are merging that branch to master branch, you are able to decide whether merging these 6 commits into 1.

Geno Chen
  • 4,916
  • 6
  • 21
  • 39