2017年8月28日 星期一

[ Git 常見問題 ] How to use git merge --squash?

Source From Here 
Question 
I have setup where we have a remote Git server, Here is the scenario which I want to perform, 
* For each bug/feature I create a different Git branch,
* I keep on committing my code in that Git branch with un-official Git messages
* In top repository we have to do one commit for one bug with official Git message,

so how can I merge my branch to remote branch so that they get just one commit for all my check-ins (I even want to provide commit message for this)? 

How-To 
Say your bug fix branch is called bugfix and you want to merge it into master
# git checkout master
# git merge --squash bugfix
# git commit

This will take all the commits from the bugfix branch, squash them into 1 commit and then merge it with your master branch.

沒有留言:

張貼留言

[Linux 常見問題] How to set a file size limit for a directory?

Source From   Here   Question   I   have a directory on my system which is used for a specific reason by applications and users , but I   d...