2010-02-16 81 views
3

可能重复:
How do I push amended commit to the remote git repo?
Undoing a git push复卷远程混帐分支

嗨,

我用

git reset --hard SHA_VALUE 
删除从我的主分支作了一次提交

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

所以我的问题是,什么是远程相当于git reset命令?

thx

+2

在这里看到:http://stackoverflow.com/questions/253055或在这里:http://stackoverflow.com/questions/1270514 – 2010-02-16 09:23:55

+1

谢谢! git push origin + master:master为我做了这个 – mvaz 2010-02-16 09:30:57

+0

在这种情况下,我投票结束时会重复“推送修改后的提交”,因为它与您正在尝试执行的操作具有相同的解决方案和陷阱。 – 2010-02-16 09:39:47

回答

0

我认为你需要做一个“git rebase”。请查阅article关于重新印刷的信息,并阅读标题为“常见重新印刷使用实践”的部分。

4

您可以使用 “混帐推” 与 “力” 选项

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.