日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

git rebase -i 修改提交

發布時間:2025/3/21 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 git rebase -i 修改提交 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

教程3 改寫提交!

6. 用rebase -i 修改提交

為了節省時間,這個教程使用現有的歷史記錄作為本地數據庫。

從這里下載

我們進入stepup-tutorial/tutorial6目錄。本地端的歷史記錄的狀態如下圖顯示。我們在這里修改「添加commit的講解」的內容。

用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”改成“edit”,然后保存并退出。將會顯示以下內容,修改過的提交呈現退出狀態。

Stopped at d286baa... 添加commit的說明 You can amend the commit now, withgit commit --amendOnce you are satisfied with your changes, rungit rebase --continue

打開sample.txt,適當地修改“commit的講解”部分。

連猴子都懂的Git命令 add 把變更錄入到索引中 commit 記錄索引的狀態 pull 取得遠端數據庫的內容

用commit?--amend保存修改。

$ git add sample.txt $ git commit --amend

現在已經commit,但是rebase操作還沒結束。若要通知這個提交的操作已經結束,請指定?--continue選項執行rebase。

$ git rebase --continue

Note

這時,有可能其他提交會發生沖突, 請修改沖突部分后再執行add和rebase?--continue。這時不需要提交。如果在中途要停止rebase操作,請在rebase指定--abort選項執行,這樣就可以抹去并停止在rebase的操作。

提交的修改完成了。如果要把多個提交修改成edit,下一個要修改的提交會退出,請執行同樣的修改。

Note

實際上,在rebase之前的提交會以ORIG_HEAD之名存留。如果rebase之后無法復原到原先的狀態,可以用git reset --hard ORIG_HEAD復原到rebase之前的狀態。


from:?http://backlogtool.com/git-guide/cn/stepup/stepup7_6.html

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的git rebase -i 修改提交的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。