gpt4 book ai didi

git - 使用 git rebase 我得到 'Nothing to do'

转载 作者:行者123 更新时间:2023-12-02 17:24:48 24 4
gpt4 key购买 nike

同题我输入“git rebase -i [commit_id]”,我得到了这个:

Error detected while processing /Users/My_name/.vimrc:
line 1:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
Press ENTER or type command to continue

回车后成功进入vim编辑器。

  1 pick f694d12 test
2
3 # Rebase 3dad5af..f694d12 onto 3dad5af (1 command(s))
4 #
5 # Commands:
6 # p, pick = use commit
7 # r, reword = use commit, but edit the commit message
8 # e, edit = use commit, but stop for amending
9 # s, squash = use commit, but meld into previous commit
10 # f, fixup = like "squash", but discard this commit's log message
11 # x, exec = run command (the rest of the line) using shell
12 # d, drop = remove commit
13 #
14 # These lines can be re-ordered; they are executed from top to bottom.
15 #
16 # If you remove a line here THAT COMMIT WILL BE LOST.
17 #
18 # However, if you remove everything, the rebase will be aborted.
19 #
20 # Note that empty commits are commented out

我删除了第一行“pick f694d12 test”并保存,我刚得到一个报告

Nothing to do

我该如何解决?

最佳答案

如果您在 merge/ rebase 期间保存了一个空文件,Git 认为您改变了主意并且不想做任何事情。查看您提供的 rebase todo 文件中的倒数第二行:

# However, if you remove everything, the rebase will be aborted.

要解决这个问题,您可以离开提交行,但使用 drop 命令。您的待办事项文件将如下所示:

drop f694d12 test

# Rebase 3dad5af..f694d12 onto 3dad5af (1 command(s))
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but 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
#
# 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.
#
# Note that empty commits are commented out

或者,如果您只想删除最后一次提交,您可以这样做:

git reset --hard HEAD^

或者:

git reset --hard 3dad5af

关于git - 使用 git rebase 我得到 'Nothing to do',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39460635/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com