提交中的拼写错误以及如果出现“ahead by 1 commit”应该怎么办

4

我提交了一些内容后发现我的注释有拼写错误,所以我重新输入了带有更正注释的 git commit -m "xxx" 命令。

结果是,当我尝试使用 git push 命令时,无法推送任何内容。

Everything up-to-date

# On branch master
# Your branch is ahead of 'origin/master' by 1 commit. 
#
nothing to commit (working directory clean)

我现在能做什么?

2个回答

5

git rebase -i origin/master将为您提供纠正超出上游存储库的提交的机会。然后,您可以git push结果。


5

正如Novelcrat所指出的那样,您可以进行交互式变基以在推送之前修复提交。将来,如果您在提交消息中犯了错误,可以使用git commit --amend进行编辑。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接