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

git--修改--无编辑拒绝推送

  •  0
  • Emaborsa  · 技术社区  · 8 年前

    今天我发现 --no-edit 对于 --amend 。然而,这导致了以下问题。以下是步骤:

    • git克隆
    • 对代码做了一些更改
    • git添加。
    • git提交--修改--无编辑
    • git推送原点主控形状

      ! [rejected]        master -> master (non-fast-forward)
      error: failed to push some refs to 'https://me@bitbucket.org/myRepo.git'
      hint: Updates were rejected because the tip of your current branch is behind
      hint: its remote counterpart. Integrate the remote changes (e.g.
      hint: 'git pull ...') before pushing again.
      hint: See the 'Note about fast-forwards' in 'git push --help' for details.
      

    为什么?

    注:我是唯一一个从事回购的人。

    1 回复  |  直到 8 年前
        1
  •  6
  •   talshorer    8 年前

    修改上次提交将重写历史记录。如果这是你想做的,你可以用 git push --force

    它告诉您您落后的原因是因为本地和远程都存在的最后一次提交(也称为“合并基”)是tip的父级。在这方面,您是远程之后的一个提交,远程已经在前面提到的合并基础之上有一个提交。