Skip to content

Instantly share code, notes, and snippets.

@vikas95prasad
Forked from dineshpanda/git_squash
Created January 21, 2022 08:18
Show Gist options
  • Save vikas95prasad/b03df74b56eb74ba0b566fa257493618 to your computer and use it in GitHub Desktop.
Save vikas95prasad/b03df74b56eb74ba0b566fa257493618 to your computer and use it in GitHub Desktop.
Squash commits keeping commit messages
git reset --soft HEAD~n && git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"
* n is the number of commits you want to squash from HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment