How to squash commits in Git?

Viewed 8145

I am trying to squash my commits and merge my branch to master as one single commit. This is what I'm trying. I switch to master branch and then i do

git merge --squash <branch_name>

And I get

Automatic merge went well; stopped before committing as requested
Squash commit -- not updating HEAD

After that I commit. But however this is what I get

$ git commit -m "Resolved"
On branch master
nothing to commit, working tree clean

For some reason the changes are not reflected and I get the message nothing to commit. I've gone through many posts and questions on stack but nothing of help until now.

2 Answers
Related