Git commit shows over 100 commits after merge

This question already has an answer here:

  • Squash my last X commits together using Git 23 answers

  • You can sqash the commits of the branch A .

    It can be done by using rebase .

    $ git rebase -i HEAD~100 // For doing operation on latest 100 commits

    This command will open a file having following details

    pick #first_commit_hash# #first_commit_message#

    pick #second_commit_hash# #second_commit_meesage#

    ... and so on

    Change pick to squash for the commits to which you want to merge into the previous commit. squash will append the commit message of the squashed commit into its previous commit. If you want to discard the commit message use fixup . You can find all the option in the file opened when you run rebase command.

    If you replace pick with squash for the 99 commits, at the end of rebase you will have 1 single commit which contains changes of all the 100 commits. Then you can merge this single commit in the branch B .

    链接地址: http://www.djcxy.com/p/27624.html

    上一篇: 一直说需要合并

    下一篇: 合并后,Git commit显示超过100次提交