andyJado
V2EX  ›  问与答

如何潜入某 commit, 神不知鬼不觉修改, 不影响历史?

  •  
  •   andyJado · Sep 19, 2022 · 2176 views
    This topic created in 1528 days ago, the information mentioned may be changed or developed.

    我目前能想到: git checkout <sha>

    - bug
    + new bug
    

    git branch nb

    git rebase ob nb

    但这还是会影响历史的吧

    3 replies  •  2022-09-19 18:55:24 +08:00
    DawnMoon
    DawnMoon
    Sep 19, 2022
    1
    git 的每一个 commit 都是基于上一个 commit 的,没法做到修改中间某个 commit 而不影响后面的 commit
    Blacate
    Blacate
    Sep 19, 2022 via iPhone
    2
    卧槽 我想到了区块链
    Jirajine
    Jirajine
    Sep 19, 2022❤️1
    3
    @Blacate 没错,git 的 commit chain 和区块链的连接机制是一样的。
    所以要“篡改”历史,就要篡改所有节点,也就是 git push -f 。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1006 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 22:23 · PVG 06:23 · LAX 14:23 · JFK 17:23
    ♥ Do have faith in what you're doing.