3 回答

神不在的星期二
TA貢獻(xiàn)1963條經(jīng)驗(yàn) 獲得超6個贊
底線
git rebase
LOCAL =你在基礎(chǔ)重建的基礎(chǔ)上
REMOTE =承諾你正在向上移動
git merge
LOCAL =您要合并的原始分支
REMOTE =你正在合并的另一個分支
換句話說,LOCAL始終是原始版本,而REMOTE總是那些之前沒有提交過的人,因?yàn)樗鼈儽缓喜⒒蛑匦露ㄎ辉陧攲?/p>
證明給我看!
當(dāng)然。不要相信我的話!這是一個簡單的實(shí)驗(yàn),您可以自己查看。
首先,確保正確配置了git mergetool。(如果你沒有,你可能無論如何都不會閱讀這個問題。)然后找一個可以使用的目錄。
設(shè)置您的存儲庫:
md LocalRemoteTestcd LocalRemoteTest
創(chuàng)建初始提交(使用空文件):
git initnotepad file.txt (use the text editor of your choice) (save the file as an empty file)git add -Agit commit -m "Initial commit."
在非master的分支上創(chuàng)建提交:
git checkout -b notmasternotepad file.txt (add the text: notmaster) (save and exit)git commit -a -m "Add notmaster text."
在主分支上創(chuàng)建提交:
git checkout masternotepad file.txt (add the text: master) (save and exit)git commit -a -m "Add master text."gitk --all
此時,您的存儲庫應(yīng)如下所示:
現(xiàn)在進(jìn)行rebase測試:
git checkout notmastergit rebase master (you'll get a conflict message)git mergetool LOCAL: master REMOTE: notmaster
現(xiàn)在進(jìn)行合并測試。關(guān)閉mergetool而不保存任何更改,然后取消rebase:
git rebase --abort
然后:
git checkout mastergit merge notmastergit mergetool LOCAL: master REMOTE: notmastergit reset --hard (cancels the merge)
您的結(jié)果應(yīng)與頂部顯示的結(jié)果相同。
添加回答
舉報
0/150
提交
取消