日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

用git rebase合并

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

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

現(xiàn)在暫時取消剛才的合并。

$ git reset --hard HEAD~

切換到issue3分支后,對master執(zhí)行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發(fā)生沖突的部分。

連猴子都懂的Git命令 add 把變更錄入到索引中 <<<<<<< HEAD commit 記錄索引的狀態(tài) ======= pull 取得遠端數(shù)據(jù)庫的內(nèi)容 >>>>>>> issue3

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

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

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

$ 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的最終內(nèi)容和merge是一樣的,但是歷史記錄如下。

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

總結(jié)

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

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。