【问题标题】:Rewinding remote git branch [duplicate]倒带远程git分支[重复]
【发布时间】:2011-01-17 07:41:03
【问题描述】:

可能的重复:
How do I push amended commit to the remote git repo?
Undoing a git push

嗨,

我已经通过使用从我的主分支中删除了一些提交

git reset --hard SHA_VALUE

但是,我在 github 上有一个远程版本的存储库,每当我 git push 时,我都会收到一条错误消息,我应该合并远程存储库中包含的更改(我不想这样做)。

所以我的问题是,git reset 命令的远程等效项是什么?

谢谢

【问题讨论】:

标签: git version-control


【解决方案1】:

你可以使用带有“force”选项的“git push”

git push -f

通过手册页:

   -f, --force
       Usually, the command refuses to update a remote ref that is not an ancestor of the local ref 
       used to overwrite it. This flag disables the check. This can cause the remote repository to 
       lose commits; use it with care.

【讨论】:

    【解决方案2】:

    我认为你需要做一个“git rebase”。检查这个article关于变基并阅读标题为“常见变基使用实践”的部分。

    【讨论】:

      猜你喜欢
      • 2017-02-18
      • 2011-10-28
      • 1970-01-01
      • 2012-10-22
      • 2016-05-06
      • 2011-06-12
      • 2016-08-28
      相关资源
      最近更新 更多