I've searched the documentation and online also, but I can seem to find a way to do Git force push aka git push --force with IntelliJ, it is easy to do with the command line but how can you do it within the IDE itself?
-
Have a look on jetbrains.com/help/idea/commit-and-push-changes.html#push , bullet point 5. Since you don't say which version of IntelliJ you have, I'm going to assume that page from the manual applies.fredrik– fredrik2020-03-14 16:00:54 +00:00Commented Mar 14, 2020 at 16:00
-
That dropdown item can't be clickedquarks– quarks2020-03-14 17:11:50 +00:00Commented Mar 14, 2020 at 17:11
Add a comment
|
1 Answer
From the Push window (Ctrl/cmd-shift-K), the Push button has a down arrow to reveal a dropdown option ‘Force Push’. This will perform at first a --force-with-lease, which if fails, will prompt a --force push.
If your branch is trying to push to master, ‘Force Push’ is grey. To enable force push to master, remove it from the list of protected branches in Preferences → Git:
2 Comments
Vaidøtas I.
Thanks! I appreciate the effort from JetBrains, but I really needed this out of the box :D
DavidBu
Interesting, but IntellIj should stop warn about "overwriting" commits. This is misleading. It should warn when it is appropriate, i.e. when force-with-lease failed, in my opinion.

