git reset --soft HEAD~7
git add --all
git commit
git push --force
First, reset git index to before the commits you want to squash. Use --soft
so that git only resets the index and doesn't touch your working directory. Then create a commit as usual.