Sublime Forum

Stash drop and custom commands (terminal) request

#1

I didn’t get how to make git stash drop from SM. I understand that reintroducing all the functionallity of the git would require huge amount of work, so it would be great if we could run custom git commands from the command pallette or at least open terminal window from SM? Please.

Thanks!

0 Likes

#2

BTW, the problem appeared when I stashed my changes and pulled current branch. Then I resolved some conflicts and clicked “save and stage”, but stash stayed untouched although changes from it staged ok.
I dropped the stage from terminal since changes were staged. So here’s the problem.

0 Likes

#3

The context menu on a stash commit in the commit graph includes options at the top to work with the stash, which includes being able to drop it:

image

Your other issue sounds like just a standard git issue, I think; when you do a git stash pop the stash isn’t automatically removed if a merge is required, so you have to do it manually. I’m not aware of any argument you can pass git in this case to force it to drop the stash for you even on conflict.

0 Likes

#4

Wow, I really didn’t checked out context menu, thank you! I searched only on the top panel where git stash and git stash pop are and in the command palette.

I just want execute custom git commands from the command palette then :slightly_smiling_face:

0 Likes

#5

That is also possible, though you have to decide in advance what the commands will be. Or if you will, you can create a command palette entry (or menu item or key binding) that executes git with any arguments you want to provide, but you can’t interactively edit the arguments, at least as far as I’m aware.

For example, the context menu item above labeled Show Branches containing this commit... is one that I added myself.

As an example, you can use Preferences > Browse Packages in Merge (just as in Sublime) and go inside of the User package and create a file named Default.sublime-commands with the following contents:

[
    {
        "caption": "Show Reflog",
        "command": "git",
        "args": {
            "argv": ["reflog"]
        }
    },

    {
        "caption": "Show Branches containing this commit...",
        "command": "git",
        "args": {"argv": ["branch", "-a", "--contains", "$commit"]}
    },
]

Once you save the file, the two new commands will be added to the command palette. When you execute a command you’ve added like this (for example Show branches containing this commit) it executes git with the given arguments. You need to click the output icon in the title area to see the output of the command:

There is some information regarding this in the documentation as well, I think,

1 Like

How do I properly Pop Stash conflict resolve?