如何使 git push origin --force ;在 Visual Studio 团队资源管理器中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45879374/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:52:52  来源:igfitidea点击:

how to make git push origin --force ; in Visual Studio Team Explorer

gitvisual-studioteam-explorer

提问by serup

I recently had an issue where I had to disregard my last commit, so on the command line I did following:

我最近遇到了一个问题,我不得不忽略上次提交,所以在命令行上我做了以下操作:

git push origin --force

this works fine, however I normally make my push/pulls from inside Visual Studio Team Explorer, however I could not find out how to --force a push from there

这工作正常,但是我通常从 Visual Studio Team Explorer 内部进行推/拉,但是我无法找到如何 --force 从那里推送

Is it possible or can it only be done from command line?

有可能还是只能从命令行完成?

回答by Wojtek T

You can enable --force without using command prompt in visual studio 2017 as follows Open team explorer.

您可以在不使用 Visual Studio 2017 中的命令提示符的情况下启用 --force,如下所示打开团队资源管理器。

Team Explorer>Settings>Git>Global Settings

团队资源管理器>设置>Git>全局设置

check the enable push --force checkbox and that should do the trick like so Check box

检查启用推送 --force 复选框,这应该像这样 复选框

For more info check out this link

有关更多信息,请查看此链接

PS. **This feature is only available in visual studio 2017+ **

附注。**此功能仅在 Visual Studio 2017+ 中可用 **