git rebase -i 汇合提交
生活随笔
收集整理的這篇文章主要介紹了
git rebase -i 汇合提交
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
教程3 改寫提交!
5. 用rebase -i 匯合提交
為了節省時間,這個教程使用現有的歷史記錄作為本地數據庫。
從這里下載
我們進入stepup-tutorial/tutorial5目錄。本地端的歷史記錄的狀態如下圖顯示。在這里匯合「添加commit的講解」和「添加pull的講解」的修改,然后合并到一個提交。
若要匯合過去的提交,請用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”,然后保存并退出。由于合并后要提交,所以接著會顯示提交信息的編輯器,請編輯信息后保存并退出。
這樣,兩個提交就合并成一個提交了。請用log命令確認歷史記錄。
from:?http://backlogtool.com/git-guide/cn/stepup/stepup7_5.html
總結
以上是生活随笔為你收集整理的git rebase -i 汇合提交的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: git reset改写提交
- 下一篇: git rebase -i 修改提交