Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Squash commits on GitHub PR

Tags:

git

github

squash

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?

like image 740
Erika Avatar asked Sep 02 '26 14:09

Erika


2 Answers

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

like image 104
Mureinik Avatar answered Sep 05 '26 11:09

Mureinik


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.

like image 35
Geno Chen Avatar answered Sep 05 '26 10:09

Geno Chen