I have a remote Git server, here is the scenario which I want to perform:
For each bug/feature I create a different Git branch
I keep on com
To squash your local branch before pushing it:
checkout the branch in question to work on if it is not already checked out.
Find the sha of the oldest commit you wish to keep.
Create/checkout a new branch (tmp1) from that commit.
git checkout -b tmp1
Merge the original branch into the new one squashing.
git merge --squash
Commit the changes which have been created by the merge, with a summary commit message.
git commit -m
Checkout the original branch you want to squash.
git checkout
Reset to the original commit sha you wish to keep.
git reset --soft
Rebase this branch based on the new tmp1 branch.
git rebase tmp1
That's it - now delete the temporary tmp1 branch once you're sure everything is ok.