Requirement: When you need to merge/PR your develop branch to master/release branch, you have lots of commit histories which are useless, and among which some are test message. Now you need to use git squash to package your commit message before your merge/PR.
Use below cmd to see your git change history and log:
git reflog
Here is the steps you need to do:
- checkout a new branch
- Under the new branch
git merge --squash <your_target_branch_which_need_to_be_packaged>
–squash will stop your commit temporarily.
git commit -m 'Your comment message here'
git push origin <your new branch>
更详细的参考博文: https://www.cnblogs.com/dsxniubility/p/4460834.html