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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

用git rebase合并

發布時間:2025/3/21 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 用git rebase合并 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

合并issue3分支的時候,使用rebase可以使提交的歷史記錄顯得更簡潔。

現在暫時取消剛才的合并。

$ git reset --hard HEAD~

切換到issue3分支后,對master執行rebase。

$ git checkout issue3 Switched to branch 'issue3' $ git rebase master First, rewinding head to replay your work on top of it... Applying: 添加pull的說明 Using index info to reconstruct a base tree... <stdin>:13: new blank line at EOF. + warning: 1 line adds whitespace errors. Falling back to patching base and 3-way merge... Auto-merging myfile.txt CONFLICT (content): Merge conflict in myfile.txt Failed to merge in the changes. Patch failed at 0001 添加pull的說明When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To check out the original branch and stop rebasing run "git rebase --abort".

和merge時的操作相同,修改在myfile.txt發生沖突的部分。

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

rebase的時候,修改沖突后的提交不是使用commit命令,而是執行rebase命令指定 --continue選項。若要取消rebase,指定 --abort選項。

$ git add myfile.txt $ git rebase --continue Applying: 添加pull的說明

這樣,在master分支的issue3分支就可以fast-forward合并了。切換到master分支后執行合并。

$ git checkout master Switched to branch 'master' $ git merge issue3 Updating 8f7aa27..96a0ff0 Fast-forwardmyfile.txt | 1 +1 files changed, 1 insertions(+), 0 deletions(-)

myfile.txt的最終內容和merge是一樣的,但是歷史記錄如下。

from:?https://backlog.com/git-tutorial/cn/stepup/stepup2_8.html

總結

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

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