gałka git squash

# Assuming you were branching from the master,
# you don't need to enter yourBranch into the reset step all the time:
git checkout yourBranch
git reset --soft HEAD~$(git rev-list --count HEAD ^master)
git add -A
git commit -m "one commit on yourBranch"

# Explanation:

git rev-list --count HEAD ^master counts the commits since you made your feature branch from the master, f.ex. 20.
git reset --soft HEAD~20 will make a soft reset of the last 20 commits. This leaves your changes in the files, but removes the commits.

#Usage:
# In my .bash_profile I have added an alias for gisquash to do this with one command:

# squash all commits into one
alias gisquash='git reset --soft HEAD~$(git rev-list --count HEAD ^master)'
#After reseting and committing you need to do a
git push --force
gdfelt