git 通过推送“强制”git提交本地到外部?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6008869/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"force" git commit on local to external via push?
提问by Skizit
Possible Duplicate:
Github first push problem… how to merge remote changes?
可能的重复:
Github 首次推送问题……如何合并远程更改?
My external repo is fairly outdated. I want to push all my local changes up stream. However, when I attempt to do so I get the following message...
我的外部仓库已经过时了。我想将所有本地更改推送到上游。但是,当我尝试这样做时,我收到以下消息...
error: failed to push some refs to 'ssh://mylink'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.
I don't want to pull because if I do those external changes will mess up my local changes. How do I override the external?
我不想拉,因为如果我做这些外部更改会弄乱我的本地更改。如何覆盖外部?
回答by LaC
git push --force remoterepository
git push --force远程存储库
回答by Rom1
What about simply overwriting your remote repo?
简单地覆盖你的远程仓库怎么样?
回答by piggy_Yu
In my opinion, it's git's protected mechinism. because, someone has pushed sth before you, so you need to pull his reputation and build with your local changes to make sure there is no conflicts. so maybe you should try to pull someone's reputation first, and then push your changes.
在我看来,这是 git 受保护的机制。因为,有人在你之前推动了某事,所以你需要拉他的声誉并根据你的本地变化进行构建,以确保没有冲突。所以也许您应该先尝试拉取某人的声誉,然后再推动您的更改。