如何使用新的提交ID更改以前的提交ID号
由于错误,我通过执行以下步骤来提交错误的Commit Id编号:
git stash
git pull --rebase
git stash apply
git add .
git commit -m "commitId: msg"
git push
git fetch
但现在我想改变我的ID。 我怎样才能做到这一点 ?
用git amend
你可以改变提交信息。 修改将当前更改合并到先前的提交中,并且还会更改提交哈希和消息。
$ git commit --amend --allow-empty -m "commitId: msg" # Commit empty change
$ git push -f origin HEAD # Force (-f) push as history is changed
链接地址: http://www.djcxy.com/p/49857.html
上一篇: How to change previous commit ID number with new Commit Id