代码之家  ›  专栏  ›  技术社区  ›  meds

恢复到以前版本的git修订版,并推动它使之成为新的头部?

  •  1
  • meds  · 技术社区  · 6 年前

    我尝试过将每次提交的更改还原到我想要的更改,但这导致了许多意想不到的问题,包括损坏和文件冲突。

    2 回复  |  直到 6 年前
        1
  •  2
  •   VonC    6 年前

    这个 this wiki for instance

    • 使用TortoiseGit命令:gitshowlog
    • 在问题开始之前选择提交点。
      • 其中BRANCH表示正在使用的分支的名称。
      • 这将删除Git中高于此点的所有提交点,并且

    然后,还是乌龟, push with the force option activated .

        2
  •  2
  •   ElpieKay    6 年前
    1. abc123 .
    2. git push origin -f abc123:<branch_namr> . 它会用 abc123型 git branch foo . 如果你想解除推力,你可以跑 git push origin -f foo:<branch_name> git reflog .
    3. 为了你当地的分公司,快跑 git checkout <branch_name>;git reset abc123 --hard