git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
brucmao
V2EX  ›  git

git 练习, rebase 疑惑

  •  
  •   brucmao · Jul 29, 2022 · 3134 views
    This topic created in 1404 days ago, the information mentioned may be changed or developed.

    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 replies    2022-10-12 14:39:15 +08:00
    sLvxq6Ya
        1
    sLvxq6Ya  
       Jul 29, 2022   ❤️ 1
    你这个在题里没问题,但实际场景这么干肯定不行

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

    但是实际上你这种写法只是给自己添了没必要的麻烦,建议好好按他的教程学吧
    xmrvabc2
        2
    xmrvabc2  
       Oct 12, 2022
    这个网站的答案在哪里看呢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1096 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 22:46 · PVG 06:46 · LAX 15:46 · JFK 18:46
    ♥ Do have faith in what you're doing.