For example, you have master and new feature branches in your remote repository. Always any new enhancement work will be made on new feature branches and once enhancements are done those changes will be merged into master.
Suppose in your new feature branches having 20-30 commits, while merging with master, history will be show all those 20-30 commits and also revert back into our previous commits(suppose some bugs came so that we have to move previous enhancement merge fixes) will be bit headache.
For that better we have to create patch(it will create a single commit, will have all changes) than it will apply to master branch so that going back to previous commits it will be very easy.
* git checkout new_feature
* git diff master >> user_defined_patch_name.patch
It will create a patch file in your current branch, than checkout to master branch than apply.
* git checkout master
* git apply user_defined_patch_name.patch
* git add .
* git commit -m"commit message"
* git push origin master
It will create a single commit in your master repository.