重绕远程git分支

mva*_*vaz 6 git version-control

可能重复:
如何将修改后的提交推送到远程git仓库?
撤消git推送

嗨,

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

git reset --hard SHA_VALUE
Run Code Online (Sandbox Code Playgroud)

我有一个github上的远程版本的存储库,每当我发现git push错误消息时,我都应该合并远程存储库中包含的更改(我不想这样做).

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

谢谢

sil*_*vio 6

您可以使用"强制"选项使用"git push"

git push -f
Run Code Online (Sandbox Code Playgroud)

通过联机帮助页:

   -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.
Run Code Online (Sandbox Code Playgroud)


ard*_*srk 1

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