【发布时间】:2019-02-23 09:51:45
【问题描述】:
假设我有一个文件“A” 我已修改文件并通过以下命令将其推送到存储库
git add A
git commit -m "changed A"
git push
后来我意识到我需要更改文件“B”,所以我修改了它并运行了以下命令
git add B
git commit --amend -m "changed AandB"
git push
但我得到错误..
error: failed to push some refs to 'https://xxx@github.com/xx/xx'
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.
我应该怎么做才能克服这个错误
【问题讨论】:
-
记住,你不需要不断地推送。仅当您希望与他人共享提交时。
-
你试图通过修改提交 A 来避免什么?是否有理由不只在 A 之上提交 B?
标签: git commit git-commit git-extensions git-amend