Search code examples
gitinteractiverebasesquash

Is there a way to squash a number of commits non-interactively?


I'm trying to squash a range of commits - HEAD to HEAD~3. Is there a quick way to do this, or do I need to use rebase --interactive?


Solution

  • Make sure your working tree is clean, then

    git reset --soft HEAD~3
    git commit -m 'new commit message'