问题
Same as title I type "git rebase -i [commit_id]", and I got this:
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
after type enter, I success to enter the vim editor.
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
I delete the line 1 "pick f694d12 test" and save it, I just got a report
Nothing to do
How can I fix it?
回答1:
If you save an empty file during a merge / rebase, Git thinks you changed your mind and don't want to do anything. See the second-to-last line in the rebase todo file you provided:
# However, if you remove everything, the rebase will be aborted.
To work around this, you can leave the commit line, but use the drop
command. Your todo file will look like this:
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
Alternatively, if all you want to do is delete the last commit, you can do this:
git reset --hard HEAD^
Or:
git reset --hard 3dad5af
来源:https://stackoverflow.com/questions/39460635/use-git-rebase-and-i-get-nothing-to-do