當(dāng)前位置:
首頁 >
git rebase -i 汇合提交
發(fā)布時(shí)間:2025/3/21
30
豆豆
生活随笔
收集整理的這篇文章主要介紹了
git rebase -i 汇合提交
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
教程3 改寫提交!
5. 用rebase -i 匯合提交
為了節(jié)省時(shí)間,這個(gè)教程使用現(xiàn)有的歷史記錄作為本地?cái)?shù)據(jù)庫。
從這里下載
我們進(jìn)入stepup-tutorial/tutorial5目錄。本地端的歷史記錄的狀態(tài)如下圖顯示。在這里匯合「添加commit的講解」和「添加pull的講解」的修改,然后合并到一個(gè)提交。
若要匯合過去的提交,請用rebase -i。
$ git rebase -i HEAD~~打開文本編輯器,將看到從HEAD到HEAD~~的提交如下圖顯示。
pick 9a54fd4 添加commit的說明 pick 0d4a808 添加pull的說明# Rebase 326fc9f..0d4a808 onto d286baa # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. #將第二行的“pick”改成“squash”,然后保存并退出。由于合并后要提交,所以接著會(huì)顯示提交信息的編輯器,請編輯信息后保存并退出。
這樣,兩個(gè)提交就合并成一個(gè)提交了。請用log命令確認(rèn)歷史記錄。
from:?http://backlogtool.com/git-guide/cn/stepup/stepup7_5.html
總結(jié)
以上是生活随笔為你收集整理的git rebase -i 汇合提交的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: git reset改写提交
- 下一篇: git rebase -i 修改提交