G’day @UloPe,
Thanks for reaching out!
To create this command, you can use the built-in push
command.
The command takes three arguments:
-
branch
— the name of the branch to push
-
remote
— the name of the remote to push to
-
mode
— the type of push to perform
Any of these arguments can be excluded, and Sublime Merge will prompt you if it can’t automatically determine them.
In order to force push, you’ll want to set the mode
argument. The mode
argument has the following options:
push
push --set-upstream
push --force
push --force-with-lease
push --no-verify
If you’re wanting to always push the currently checked-out branch, you’ll need to set the branch
argument too. Sublime Merge has a special $head
value, that evaluates to the currently checked out branch.
Putting this together, you can do something like this:
[
{
"caption": "Force Push With Lease",
"command": "show_command_palette",
"args":
{
"command": "push",
"args": { "branch": "$head", "mode": "push --force-with-lease" },
}
},
]
As an aside, I’m looking into ways to improve our documentation of commands to make defining custom commands easier.
Cheers,
- Dylan from Sublime HQ