步骤一:使用git log命令查看之前的commit记录,找到要修改的commit的哈希值。 步骤二:使用git rebase -i命令,对要修改的commit进行交互式重新排列。这里的是要修改的commit的哈希值。运行该命令后,会打开一个交互式的文本编辑器。 步骤三:在文本编辑器中,将要修改的commit的行的pick标记修改为edit,并保存退出。 步骤...
pick =use commit9# r, reword =use commit, but edit the commit message10# e, edit = use commit, but stopforamending11# s, squash =use commit, but meld into previous commit12# f, fixup = like
pick = use commit#e, edit = use commit, but stopforamending#s, squash = use commit, but meld into previous commit## If you remove a line here THAT COMMIT WILL BE LOST.#However,ifyou remove everything, the rebase will be aborted.# ...
1. 首先,使用`git log`命令查看commit历史,确定要删除的commit的哈希值(commit hash)。 2. 然后,使用`git revert`命令撤销特定commit引入的更改,并创建一个新的commit来保存这个撤销操作。 3. 最后,使用`git push`命令将新的commit推送到远程仓库。 示例: “` // 查看commit历史 $ git log // 撤销特定commi...
# e, edit <commit> = use commit, but stop for amending # s, squash <commit> = use commit, but meld into previous commit # f, fixup <commit> = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # b, break...
# Commands:# p,pick<commit>=use commit # r,reword<commit>=use commit,but edit the commit message # e,edit<commit>=use commit,but stopforamending # s,squash<commit>=use commit,but meld into previous commit # f,fixup<commit>=like"squash",but discardthiscommit's log message ...
# edit = use commit, but stop for amending //改上面的 pick 为 edit # squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. ...
edit the commit message# e, edit = use commit, but stop for amending# s, squash = use commit, but meld into previous commit# f, fixup = like "squash", but discard this commit's log message# x, exec = run command (the rest of the line) using shell# d, drop = remove commit ...
找到需要修改的 commit 记录,把pick修改为edit或e,:wq保存退出。也就是: edit e0871dfb91f6a0acc5298d9e1960291629479a46 fix:fuckingthecodepick 0a4549598e56b53395c562e784553d863ec597c1 fix:正常的提交信息1# ... 三、修改 commit 的具体信息 ...
git commit -a -m"fixup greeting.txt" 现在文件看起来正确,但是我们的历史记录可以更好一点 —— 让我们使用新的提交来“修复”(fixup)最后一个提交。为此,我们需要引入一个新工具:交互式变基。我们将以这种方式编辑最后三个提交,因此我们将运行git rebase -i HEAD~3(-i代表交互式)。这样会打开文本编辑器,...