git 撤销上次commit提交
1.git reset --soft head~1(撤销上一次commit, 不会撤销git add)2.git reset head~(撤销上一次commit, 同时撤销git add)3.git reset --hard head~1(这个会直接撤销上次commit同时会撤销改动的代码 --(不建议使用)head~ 和 head~1效果是一样的...
文章共206字 · 阅读需要大约1分钟
一键AI生成摘要,助你高效阅读
问答
·
git撤销上次commit提交(还在本地)
1.git reset --soft head~1 (撤销上一次commit, 不会撤销git add)
2.git reset head~ (撤销上一次commit, 同时撤销git add)
Git版本回退 (git log 可以查看 commit_id)
Git版本回退()
1.git reset --hard head^ (回退到上个版本)
2.git reset --hard head~2 (回退到第2个版本)
3.git reset --hard commit_id (回退到指定版本)
head~ 和 head~1效果是一样的
谨慎操作 回退之后就看不到回退版本之前的 commit_id 了
更多推荐
已为社区贡献8条内容
所有评论(0)