git - 如何返回 git master 分支?
问题描述
这是我在 gitlab 上的主分支。我想撤消以前的提交,因为 master 现在不工作。
使用终端,我应该切换到 master 分支,然后:
git revert f23...
这是获取更多信息的管道,我想回到箭头:
解决方案
你可以试试
git reset --soft "HEAD~3"
这将删除您的前 3 个提交。接下来你可以运行:
# remove the staged files
git restore --staged .
# remove the changed files
git checkout -- .
现在做一些改变并运行:
# add your change
git add .
# commit the change
git commit -m "my change"
# force the push and replace the history
git push -f
推荐阅读
- go - golan-gin api 返回无效的 URL 转义 %
- php - 使用 PHP/HTML 在表单验证中突出显示空文本框
- javascript - 无法滚动网格直到记录结束
- bunifu - Bunifu Flat Button: Selected Property Problem (取消选择本身)
- python-3.x - Pip install 在窗口上的 docker 容器中不起作用
- swift - 在 Swift 中将 GPS 元数据写入 EXIF
- javascript - 失去地图功能的上下文
- r - R函数ggplot和lines一起不起作用,每次发送不同的警告消息
- python - sphinx 默认模板是什么?
- crystal-reports - Crystal Reports 文本旋转