【问题标题】:revert the branch in a git to the previous commit in the same branch [duplicate]将git中的分支恢复为同一分支中的上一个提交[重复]
【发布时间】:2020-03-01 13:41:27
【问题描述】:

我想撤消分支中的合并提交

从 e6a49a..... 到 4dea6ee.... 6 个文件中存在冲突,我已经解决了这些问题并提交了,但是当我尝试创建 Pull 请求时,它给我带来了 100 多个不应该发生的整个项目的文件。只是猜测可能是文件类型可能有变化。所以只是想恢复合并提交。我该怎么做呢

【问题讨论】:

标签: git git-merge git-commit git-revert


【解决方案1】:
  • git reset --soft HEAD~1(我认为这是最后一次提交)
  • git status(查看哪些文件受到影响)
  • git reset 文件名(例如:git reset test.py)
  • git push origin branch_name -f

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-19
    • 2017-02-01
    • 2012-03-05
    • 2013-04-07
    • 2013-11-30
    • 2012-09-02
    • 2018-11-01
    相关资源
    最近更新 更多