Is it possible to git push –force in vscode?

Since 1.35 (May 2019), provided that Settings > Extensions > Git > Allow Force Push is set, the force push option is also visible in the Git menu (three dots, more actions), sub-menu “Pull, Push“.

You must first enable it in settings:

settings

Git Menu

Force push now visible

Note: You needed, with 1.35, to restart VSCode (or at least “Reload (VSCode) windows”) in order to see that new option.
With more recent version of VSCode (1.65, 2022), no need to reload/restart.

See issue 62020, closed with PR 62021.

As noted by CletusW in the comments:

Note also by default this uses the safer --force-with-lease option, also configurable in Settings > Extensions > Git, toward the bottom

I detailed --force-with-lease in “git push --force-with-lease vs. --force“.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)