首页 > 解决方案 > 重置分支 master 中的 git commit:致命:不明确的参数“提交”:未知修订或路径不在

问题描述

我想去 Commit with ID f8d3157 但它显示错误: git log --oneline:

706b743 (HEAD -> master) api real connect login
f8d3157 Ui regester page
722ec67 Ui Logi page
fa400a0 connect api.js in Home-post
a5a6e68 connect api.js in SideRight
128908f connect  api.js in sideLeft
42c0a87 aad file config  api instance

git reset --hard commit f8d3157

fatal: ambiguous argument 'commit': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

标签: git

解决方案


如果你只想去这个特定的提交使用

git checkout f8d3157

这将创建一个分离的头部,所以一旦在这里你可以使用

git checkout -b new_branch_name 

创建一个新分支并开始工作。

小心!如果您使用 git reset 您将丢失一些提交,也许还有一些未提交的代码......这里的命令:

git reset --hard commit f8d3157

推荐阅读