git - 重置分支 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 checkout f8d3157
这将创建一个分离的头部,所以一旦在这里你可以使用
git checkout -b new_branch_name
创建一个新分支并开始工作。
小心!如果您使用 git reset 您将丢失一些提交,也许还有一些未提交的代码......这里的命令:
git reset --hard commit f8d3157
推荐阅读
- c# - 如何使用自动映射器和反射根据字段名称动态映射
- python - 我在 folium 和 pandas 的帮助下尝试了这段代码,但它显示了这个错误
- node.js - 堆限制附近的无效标记压缩分配失败 - Nodejs 应用程序的 tsc 命令,而 git 推送到 dokku
- python - 使用位循环的解密逻辑
- python - 如何用同一索引中的另一个新元素替换一个元素并将前一个元素移动到下一个索引
- python - Python包模块未找到错误
- swiftui - SWIFTUI 绑定未更新
- google-apps-script - 复制并与同一个人共享 Google Doc
- arrays - lc3 停止循环遍历数组
- amazon-web-services - AWS Kinesis Data Firehose 将文件输出到 S3 存储桶。如何/在哪里转换数据?