V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
brucmao
V2EX  ›  git

git 练习, rebase 疑惑

  •  
  •   brucmao · 2022-07-29 16:11:26 +08:00 · 2091 次点击
    这是一个创建于 608 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://learngitbranching.js.org/?locale=zh_CN

    高级话题的第一题

    合并多个分支成一条线,答案是这样的

    $ git rebase main bugFix
    
    $ git rebase bugFix side
    
    $ git rebase side another
    
    $ git rebase another main
    

    和下面有区别吗,提示通过了

    $ git rebase c2 c3
    
    $ git rebase c3' c6
    
    $ git rebase c6' c7
    
    $ git rebase c7' main
    
    2 条回复    2022-10-12 14:39:15 +08:00
    sLvxq6Ya
        1
    sLvxq6Ya  
       2022-07-29 16:27:42 +08:00   ❤️ 1
    你这个在题里没问题,但实际场景这么干肯定不行

    参考 git 文档, 由于 branch 本质是对 commit 的引用,所以光从语法上来说,很多时候 branch 和 commit 是可以相互替代的
    https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell

    但是实际上你这种写法只是给自己添了没必要的麻烦,建议好好按他的教程学吧
    xmrvabc2
        2
    xmrvabc2  
       2022-10-12 14:39:15 +08:00
    这个网站的答案在哪里看呢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5484 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 08:55 · PVG 16:55 · LAX 01:55 · JFK 04:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.