I have a branch with about 20 commits.
The first SHA on the branch is bc3c488...
The last SHA on the branch is 2c2be6...
How can I
If the first SHA is HEAD you can also use this approach:
git reset --soft $OLD_SHA; git add -A; git commit --amend --no-edit
be careful, this command will change the history of the repo.
If you want to squash commits that are in the middle of your history:
|---* --- 0 --- 1 ---- 2 --- 3 --- * --- * --- * --- HEAD
like in this case the commits 1, 2 and 3
I would really recommend to use rebase -i