git merge --squash改写提交
生活随笔
收集整理的這篇文章主要介紹了
git merge --squash改写提交
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
教程3 改寫提交!
7. merge --squash
為了節(jié)省時(shí)間,這個(gè)教程使用現(xiàn)有的歷史記錄作為本地?cái)?shù)據(jù)庫。
從這里下載
我們移動(dòng)到stepup-tutorial/tutorial7目錄。本地端的歷史記錄的狀態(tài)如下圖顯示。把issue1分支的所有提交合并成一個(gè)提交,并導(dǎo)入到master分支。
切換到master分支后,指定?--squash選項(xiàng)執(zhí)行merge。
$ git checkout master Switched to branch 'master' $ git merge --squash issue1 Auto-merging sample.txt CONFLICT (content): Merge conflict in sample.txt Squash commit -- not updating HEAD Automatic merge failed; fix conflicts and then commit the result.看來發(fā)生沖突了。請(qǐng)打開sample.txt,修改沖突的部分,然后提交。
$ git add sample.txt $ git commit [master 0d744a7] Conflicts: sample.txt1 files changed, 4 insertions(+), 0 deletions(-)issue1分支上所有的提交都匯合并添加到master分支了。請(qǐng)用log命令確認(rèn)歷史記錄。
from:?http://backlogtool.com/git-guide/cn/stepup/stepup7_7.html
總結(jié)
以上是生活随笔為你收集整理的git merge --squash改写提交的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: git rebase -i 修改提交
- 下一篇: 浅谈Java中的Set、List、Map