[{"data":1,"prerenderedAt":250},["ShallowReactive",2],{"content-query-rpCfsRRFex":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"body":13,"_type":244,"_id":245,"_source":246,"_file":247,"_stem":248,"_extension":249},"/technology-blogs/zh/582","zh",false,"","【git 和gitee 从入门到实践】git 解冲突流程","解冲突流程","2021-05-31","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2021/05/31/aa2020fa99a245339b3079a01a3f86de.png","technology-blogs",{"type":14,"children":15,"toc":230},"root",[16,24,28,43,55,66,72,79,89,95,103,109,117,123,131,137,145,151,156,161,170,175,180,185,193,198,206,211,216,222],{"type":17,"tag":18,"props":19,"children":21},"element","h1",{"id":20},"git-和gitee-从入门到实践git-解冲突流程",[22],{"type":23,"value":8},"text",{"type":17,"tag":25,"props":26,"children":27},"h3",{"id":7},[],{"type":17,"tag":29,"props":30,"children":31},"p",{},[32,34],{"type":23,"value":33},"作者：",{"type":17,"tag":35,"props":36,"children":40},"a",{"href":37,"rel":38},"https://bbs.huaweicloud.com/forum/home.php?mod=space&uid=224825&do=thread",[39],"nofollow",[41],{"type":23,"value":42},"琦玉",{"type":17,"tag":29,"props":44,"children":45},{},[46,48],{"type":23,"value":47},"来源：",{"type":17,"tag":35,"props":49,"children":52},{"href":50,"rel":51},"https://bbs.huaweicloud.com/forum/forum-1076-1.html",[39],[53],{"type":23,"value":54},"MindSpore论坛",{"type":17,"tag":29,"props":56,"children":57},{},[58,60],{"type":23,"value":59},"原帖：",{"type":17,"tag":35,"props":61,"children":64},{"href":62,"rel":63},"https://bbs.huaweicloud.com/forum/thread-131011-1-1.html",[39],[65],{"type":23,"value":62},{"type":17,"tag":18,"props":67,"children":69},{"id":68},"git-解冲突流程",[70],{"type":23,"value":71},"git 解冲突流程",{"type":17,"tag":73,"props":74,"children":76},"h5",{"id":75},"_1-进入到本地mindspore仓库-并切换到master分支",[77],{"type":23,"value":78},"1. 进入到本地mindspore仓库， 并切换到master分支",{"type":17,"tag":80,"props":81,"children":83},"pre",{"code":82},"cd mindspore\ngit checkout master\n",[84],{"type":17,"tag":85,"props":86,"children":87},"code",{"__ignoreMap":7},[88],{"type":23,"value":82},{"type":17,"tag":73,"props":90,"children":92},{"id":91},"_2-关联远程的mindspore的主仓",[93],{"type":23,"value":94},"2. 关联远程的mindspore的主仓",{"type":17,"tag":80,"props":96,"children":98},{"code":97},"git remote add mindspore https://gitee.com/mindspore/mindspore.git\n",[99],{"type":17,"tag":85,"props":100,"children":101},{"__ignoreMap":7},[102],{"type":23,"value":97},{"type":17,"tag":73,"props":104,"children":106},{"id":105},"_3-拉取最新的mindspore主仓代码merge到自己仓库的master分支",[107],{"type":23,"value":108},"3. 拉取最新的mindspore主仓代码，merge到自己仓库的master分支",{"type":17,"tag":80,"props":110,"children":112},{"code":111},"git fetch mindspore && git merge mindspore/\n",[113],{"type":17,"tag":85,"props":114,"children":115},{"__ignoreMap":7},[116],{"type":23,"value":111},{"type":17,"tag":73,"props":118,"children":120},{"id":119},"_4-切换到自己的冲突的分支",[121],{"type":23,"value":122},"4. 切换到自己的冲突的分支",{"type":17,"tag":80,"props":124,"children":126},{"code":125},"git checkout xxx\n",[127],{"type":17,"tag":85,"props":128,"children":129},{"__ignoreMap":7},[130],{"type":23,"value":125},{"type":17,"tag":73,"props":132,"children":134},{"id":133},"_5-把自己仓库更新后的master分支代码rebase到自己的冲突分支",[135],{"type":23,"value":136},"5. 把自己仓库更新后的master分支代码rebase到自己的冲突分支",{"type":17,"tag":80,"props":138,"children":140},{"code":139},"git rebase master\n",[141],{"type":17,"tag":85,"props":142,"children":143},{"__ignoreMap":7},[144],{"type":23,"value":139},{"type":17,"tag":73,"props":146,"children":148},{"id":147},"_6-解冲突",[149],{"type":23,"value":150},"6. 解冲突",{"type":17,"tag":29,"props":152,"children":153},{},[154],{"type":23,"value":155},"下面是一个例子",{"type":17,"tag":29,"props":157,"children":158},{},[159],{"type":23,"value":160},"rebase过程中， 发生了冲突， 终端上会有提示, 如下所示:",{"type":17,"tag":29,"props":162,"children":163},{},[164],{"type":17,"tag":165,"props":166,"children":169},"img",{"alt":167,"src":168},"1622270946405.png","https://bbs-img.huaweicloud.com/data/forums/attachment/forum/202105/29/173827jecppnbcj1xcokds.png",[],{"type":17,"tag":29,"props":171,"children":172},{},[173],{"type":23,"value":174},"1）如截图所示， model_zoo/official/cv/faster_rcnn/train.py发生冲突",{"type":17,"tag":29,"props":176,"children":177},{},[178],{"type":23,"value":179},"2）编辑该文件， 解决冲突， 冲突部分会用 > 格式进行包裹。 改成自己需要的内容即可。",{"type":17,"tag":29,"props":181,"children":182},{},[183],{"type":23,"value":184},"修改前：",{"type":17,"tag":29,"props":186,"children":187},{},[188],{"type":17,"tag":165,"props":189,"children":192},{"alt":190,"src":191},"1622271022796.png","https://bbs-img.huaweicloud.com/data/forums/attachment/forum/202105/29/173919qliju8uuoirljbqw.png",[],{"type":17,"tag":29,"props":194,"children":195},{},[196],{"type":23,"value":197},"修改后:",{"type":17,"tag":29,"props":199,"children":200},{},[201],{"type":17,"tag":165,"props":202,"children":205},{"alt":203,"src":204},"1622271055898.png","https://bbs-img.huaweicloud.com/data/forums/attachment/forum/202105/29/173949rol9xk1opmwi9rr8.png",[],{"type":17,"tag":29,"props":207,"children":208},{},[209],{"type":23,"value":210},"1）git add . (把已经解决完冲突的文件添加到暂存区)",{"type":17,"tag":29,"props":212,"children":213},{},[214],{"type":23,"value":215},"2）git rebase --continue (完成rebase过程)",{"type":17,"tag":73,"props":217,"children":219},{"id":218},"_7-解冲突后强制推送到自己的远程仓库",[220],{"type":23,"value":221},"7 . 解冲突后强制推送到自己的远程仓库",{"type":17,"tag":80,"props":223,"children":225},{"code":224},"git push -f\n",[226],{"type":17,"tag":85,"props":227,"children":228},{"__ignoreMap":7},[229],{"type":23,"value":224},{"title":7,"searchDepth":231,"depth":231,"links":232},4,[233],{"id":7,"depth":234,"text":7,"children":235},3,[236,238,239,240,241,242,243],{"id":75,"depth":237,"text":78},5,{"id":91,"depth":237,"text":94},{"id":105,"depth":237,"text":108},{"id":119,"depth":237,"text":122},{"id":133,"depth":237,"text":136},{"id":147,"depth":237,"text":150},{"id":218,"depth":237,"text":221},"markdown","content:technology-blogs:zh:582.md","content","technology-blogs/zh/582.md","technology-blogs/zh/582","md",1776506138236]