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.

沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...