在 git

问题描述

Commit 1 包含 file1file2

我对 file2 进行了一些更改并将其提交为 commit2 但我希望 commit2 包含 file1file2,即使 file1 没有变化。

我想要一个包含/合并 commit1commit2

有没有办法在 git 中做到这一点?

为什么我必须在提交中包含未修改文件

我的部署是使用作为提交的一部分生成的哈希 ID 进行的。因此,在这种情况下,如果我提供 commit2,那么它将仅包含 file2,因此我想创建一个包含 commit1commit2 中的更改的提交。这可能是一种非常规的方式,但这是我的要求!

解决方法

(onPanelShow)="onMsPanelShow()"

onMsPanelShow()
{
    if(document.getElementsByClassName(
    "p-multiselect-filter p-inputtext p-component"
    )){
        document.getElementsByClassName(
        "p-multiselect-filter p-inputtext p-component"
        ).item(0).setAttribute("type","search");
    }
}

其中 2 是您要回滚的提交数。之后,您将在两次提交中所做的所有更改都设为未提交。您将需要再次提交。