【发布时间】:2016-07-21 20:33:26
【问题描述】:
经常(尤其是使用--amend 提交时)我使用git push heroku master --force 推送到heroku。我这样做是因为我在尝试用力推动时遇到问题..
问题:
o https://git.heroku.com/site.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/site.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 中也有更正确的方法来修复它
-
通常,强制推送被用作在遥控器上重写历史记录的一种方式。这可以通过剥离提交或将新提交放到旧的 Git 对象上。有多少人拥有 Heroku 应用程序的写入权限?是否有可能有人将提交推送到 Heroku 应用程序,但没有推送到您一直从中进行拉取的另一个共享远程(如 GitHub)?
标签: ruby-on-rails node.js git heroku