DEV Community

loading...
Cover image for GitHub Squash commits on your branch

GitHub Squash commits on your branch

Niharika Pujari
Sarcastic Being. Front-End Engineer.
・1 min read

Squash all your commits on a branch?

  • Get a complete history of commits by running:

Alt Text

  • Now, run the below command to squash the commits on your branch, Number of commits = commits you would like to squash.

Alt Text

  • After you run the previous command you now need to pick the commits you would like to squash, personally I use f to pick the commits. So instead of pick INSERT f (replace pick with f) expect for the first commit.

Alt Text

ESC, :x to exit VIM.

  • Verify in git log and your commits should be squashed.

Discussion (0)