Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

like image 206
serup Avatar asked Aug 25 '17 10:08

serup


People also ask

How do I force git push in Visual Studio?

To enable force push, go to the top level menu, select “Git > Settings” and check the “Enable push --force” option. I hope this helps!

How do I force a git push?

To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch).


1 Answers

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

Team Explorer>Settings>Git>Global Settings

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

For more info check out this link

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

like image 178
AutoTester213 Avatar answered Sep 26 '22 11:09

AutoTester213