我試圖用來git rebase -i改進我的提交訊息。我是唯一一個為這個導演作業的人。錯誤地,在編輯器中打開的檔案變成了這樣:
noop
# Rebase d172428..d172428 onto d172428 (1 command)
#
# Commands:
# p, pick <commit> = use commit
# 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 [-C | -c] <commit> = like "squash" but keep only the previous
# commit's log message, unless -C is used, in which case
# keep only this commit's message; -c is same as -C but
# opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified); use -c <commit> to reword the commit message
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
我中止了 rebase 并嘗試再次執行此操作,但檔案以相同的內容打開。我嘗試通過添加我的提交 SHA 和訊息來重寫原始內容(如教程中的示例)。我運行$ git rebase -i并重寫了如下內容:
pick d172428 (HEAD -> master, origin/master) Add LCD Driver
pick cf6c9a2 Create README.md
pick 6c9286f Initial commit, first effort
# Rebase d172428..d172428 onto d172428 (1 command)
#
# Commands:
# p, pick <commit> = use commit
# 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 [-C | -c] <commit> = like "squash" but keep only the previous
# commit's log message, unless -C is used, in which case
# keep only this commit's message; -c is same as -C but
# opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified); use -c <commit> to reword the commit message
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
但錯誤看起來像:
interactive rebase in progress; onto d172428
Last command done (1 command done):
pick d172428 Add LCD Driver
Next commands to do (2 remaining commands):
pick cf6c9a2 Create README.md
pick 6c9286f Initial commit, first effort
(use "git rebase --edit-todo" to view and edit)
You are currently rebasing branch 'master' on 'd172428'.
(all conflicts fixed: run "git rebase --continue")
nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
Otherwise, please use 'git rebase --skip'
Could not apply d172428... Add LCD Driver
我試圖改變pick到edit的例子。我試過跳過,繼續和中止。有同樣的問題。每次我中止并嘗試再次變基時,檔案都以相同的 contnet 開頭noob。如何
uj5u.com熱心網友回復:
假設您還想一直變基回到第一次提交,您應該使用:
git rebase -i --root
這應該會顯示您所看到的相同螢屏:
pick d172428 (HEAD -> master, origin/master) Add LCD Driver
pick cf6c9a2 Create README.md
pick 6c9286f Initial commit, first effort
作為指示說,你可能會改變pick,以reword對所有提交上市:
reword d172428 (HEAD -> master, origin/master) Add LCD Driver
reword cf6c9a2 Create README.md
reword 6c9286f Initial commit, first effort
然后按ESC后按:wq保存并關閉。這將啟動變基。rebase 將從根提交重新應用您的每個提交,允許您改寫提交訊息。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/406707.html
標籤:
上一篇:zsh自定義函式中斷
