git --amend --no-edit拒绝推送

问题描述 投票:-1回答:1

今天我发现了--no-edit--amend。但是,它引出了以下问题。这里的步骤:

  • git clone
  • 对代码做了一些更改
  • git add。
  • git commit --amend --no-edit
  • git push origin master ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://[email protected]/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.

为什么?

注意:我是唯一一个处理该回购的人。

git push amend
1个回答
5
投票

修改上次提交会重写历史记录。如果你想做什么,你可以用git push --force做到这一点。

它告诉你落后的原因是因为本地和远程存在的最后一次提交(又名“合并基础”)是提示的父级。在这方面,你是远程的一个提交,它已经在上述合并基础之上提交了一个提交。

© www.soinside.com 2019 - 2024. All rights reserved.