Sublime Forum

Create tag and push to remote from single command



Is there a way to create a command for creating a tag and pushing it to remote at the same time?




Yes, somewhat. I was originally going to suggest using the chain command (example here), but it doesn’t wait for the create_tag command to finish before running the second command. Therefore, the only other solution is to create a custom git alias (example here) to handle both operations. You would need to use the $text selector in your custom command/menu/key binding to ask for the new tag name, but you cannot ask for multiple inputs & thus cannot specify a tag message.



Ah cheers!, that works for me…

here is what I’ve got

Add an alias to create a tag and push

tagandpush = "!f() { git tag \"$1\" \"$2\"; git push origin \"$1\"; }; f"

Then add a key map to trigger it

    "keys": ["ctrl+shift+t"],
    "command": "show_command_palette",
            "command": "git", 
            "args": {"argv": ["tagandpush", "$text", "$commit"]}


There is a chain command which I believe should be perfect for this but I’ve never seriously use SM yet. Hopefully someone may give an example.

BUILD 2054

4 May 2021

  • Added the chain command, which accepts a list of commands to run in its “commands” argument - useful for chaining Git commands together


@jfcherng, see my second sentence; the chain command doesn’t wait for user input, or maybe the first command doesn’t block.

1 Like


I created this bug report in hopes that user input can be supported within the chain command: