You will often face the merge of the Dev branch or many scattered branches into a public release branch.
But there is a situation where you need to deal with a lot of commit records in your dev branch. These commits do not need to be reflected in the release.
Develop Main Branch
650) this.width=650; "title=" 1 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" 1 "src=" http://s3.51cto.com/wyfs02/M01/89/B6/ Wkiol1gaukxaai2daabqui0e0uq560.png "width=" 480 "height=" 333 "/>
A recent commit to the Develop master branch is "fix ImagePrint bug." We pull out a branch for project development, and there will be a lot of commit records.
git checkout-b develop_newfeature_importdatainterface origin/develop
The commit log of the Develop_newfeature_importdatainterface branch is identical to the develop. We add a point to modify commit.
650) this.width=650; "title=" 2 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" 2 "src=" http://s3.51cto.com/wyfs02/M00/89/B8/ Wkiom1gaukeqhufiaabnzlndkgg429.png "width=" 427 "height=" "/>"
Now we need to merge the commit of the Develop_newfeature_importdatainterface branch into the develop main branch. In merging into the develop we want to see only one commit in the commit log in develop, and this commit message is not very casual, but conforms to the formal submission process, for example, "Develop: Finished import data Interface ".
We need to re-prepare the commit using the git merge–squash command parameter. (This is a clear merge operation unlike Git rebase, do not confuse the role of these two commands.) )
git merge--squash develop_newfeature_importdatainterface
Updating Cc1fea6. e6fb522
Fast-forward
Squash Commit--not updating HEAD
1.txt | 3 + + +
1 file changed, 3 insertions (+)
--squash will suspend commit. Otherwise a merge will automatically commit the commit.
650) this.width=650; "title=" 3 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" 3 "src=" http://s3.51cto.com/wyfs02/M02/89/B6/ Wkiol1gaukfzsaqjaaacucttwfu226.png "width=" 446 "height=" 113 "/>
1.txt file is the file we modified, it is now pending commit. Now we just need to resubmit.
Git commit-m ' develop:finished Import Data interface '
650) this.width=650; "title=" 4 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" 4 "src=" http://s3.51cto.com/wyfs02/M00/89/B6/ Wkiol1gaukntgzglaabkn9zq9na669.png "width=" 511 "height=" 411 "/>
So every time the merge will be very refreshing, at a glance, even if the reset is also convenient.
Talk about git merge--squash