Often I want to squash several dozen commits in a junk branch to test things out on a staging server. Specially when using an issue tracker with issue auto-closing feature like bitbucket - I don't want to close the issues mentioned in the commit messages at that moment, so I need to squash.

There has to be something easier than changing each line individually on rebase or having to know how many commits ago is the target of the squash.

Something like "Squash everything until this commit with hash XXXXXX"