Reputation: 3246
In Git after last push to remote repo I worked on master branch. I have 6 commits to push now. I want to squash these 6 into 1 commit message then do push.
Any suggestion?
Upvotes: 1
Views: 180
Reputation: 108121
If you are ok with writing a new commit message
git reset --soft HEAD~6
git commit
This will the last 6 commits and put them back in the staging area. The subsequent commit will then include all the changes.
If you instead want to preserve the commit messages
git rebase -i HEAD~6
and in the interactive editor, replace 'pick' with 'fixup' for the last 5 commits.
This will create a unique commit, containing all the 6 commit messages.
Upvotes: 3