我在 git 中进行了 2 次提交,即“版本 1”和“版本 2”。之后我对代码进行了另一次更改并使用了 git commit -m "version 1" --amend。我认为它将向版本 1 添加新的更改,但它将版本 2 提交消息的名称从“版本 2”更改为“版本 1”,并向其添加了新的更改。所以,现在我有两个版本 1 提交。但我想在原始版本 1 中添加新的更改。我该怎么做以及如何撤消此 --amend?请解释一下。
before changes
git log
commit hash
version 2
commit hash
version 1
after changes
git commit -m "version 1" --amend
git log
commit hash
version 1 (This is where the new changes happened)
commit hash
version 1 (I want it to go here)