步骤一:使用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.# ...
# r, reword <commit> = use commit, but edit the commit message # 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 ...
git commit -a -m"fixup greeting.txt" 现在文件看起来正确,但是我们的历史记录可以更好一点 —— 让我们使用新的提交来“修复”(fixup)最后一个提交。为此,我们需要引入一个新工具:交互式变基。我们将以这种方式编辑最后三个提交,因此我们将运行git rebase -i HEAD~3(-i代表交互式)。这样会打开文本编辑器,...
# 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...
找到需要修改的 commit 记录,把pick修改为edit或e,:wq保存退出。也就是: edit e0871dfb91f6a0acc5298d9e1960291629479a46 fix:fuckingthecodepick 0a4549598e56b53395c562e784553d863ec597c1 fix:正常的提交信息1# ... 三、修改 commit 的具体信息 ...
git commit --amend #输入修改后的commit message,保存 git push <remote> <branch> -f #若还没有推送到远端,不用输入 1. 2. 3. 4. 5. 方法二:用reset后修改 这种方法与上面方法基本一致,也可以修改提交内容和commit message。这种方式在还没有推送到远端的情况下也可以比较方便的保持原有的Change-Id,(...
1.选取最近3次的历史提交。 // git rebase -i HEAD~32.按i 进入vim编辑模式3.基于以下指令进行修改r, reword <commit> = use commit, but edit the commit message // 修改commit信息 s, squash <commit> = use commit, but meld into previous commit // 合并到上次commit ...
# s, squash=use commit, but meld into previous commit # f, fixup= like"squash", but discardthiscommit's log message# x, exec = run command (the rest of the line)usingshell # d, drop= remove commit 对于要更改日期的所有提交,请将git status替换为edit(或仅更改为e),然后保存并退出编辑...