【问题标题】:Is there any harm in force pushing to heroku all the time一直强制向heroku推送有什么害处吗
【发布时间】: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


【解决方案1】:

出现此警告是因为提交不同,因此您的存储库无法确保数据保存,这是一种不好的做法,因为它可能导致代码数据丢失,只要您知道它不会丢失,Heroku 本身不会有问题因为它所做的只是获取主分支中的代码并部署它,而不管之前的状态如何。

【讨论】:

    猜你喜欢
    • 2020-08-22
    • 2011-12-19
    • 2011-01-07
    • 2017-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-04
    • 1970-01-01
    相关资源
    最近更新 更多