代码之家  ›  专栏  ›  技术社区  ›  zedoo

在git 1.5.6.5中模拟--ff

git
  •  1
  • zedoo  · 技术社区  · 16 年前

    Debian stable有git 1.5.6.5,它在git pull/git merge中缺少--ff-only选项。有没有办法用一系列可选的git命令来模拟这种行为?

    2 回复  |  直到 16 年前
        1
  •  1
  •   Community Mohan Dere    9 年前

    您可以测试其中一个提交是否是另一个提交的后代。如果一个是,那么这就是快进合并的定义。

    如果commit A是commit B的后代(如中所示,B是A的第n个父级),那么:

    $ git checkout B
    $ git merge A #<--- this is a fast-forward merge
    

    但是测试提交是否是后代并不是最简单的。答案就在这里: How can I tell if one commit is a descendant of another commit?

        2
  •  1
  •   zedoo    16 年前