Sublime Forum

Can I stash a specific file?

#1

I sometimes stash specific files using

git stash push <path_to_file>

Is this possible through sublime merge?

If not I would appreciate a stash button next to the discard / stage or something like that.

0 Likes

#2

see Features Request: Stage file by filename

0 Likes

#3

Thanks for this, but this is about staging not stashing.

0 Likes

#4

Create a file “Diff Context.sublime-menu” in your package user directory and paste the following:

[
    {
        "caption": "Stash file",
        "command": "git",
        "args": {"argv": ["stash", "push", "$path"]}
    }
]

Now when you right click in the diff of a file in your working directory you can stash just this file.

7 Likes

#6

Sweet, this worked thank you very much!

0 Likes

#7

Wow! This is some serious sorcery!

FYI: “package user directory” details can be found here.
https://www.sublimemerge.com/docs/packages

0 Likes

#8

This is great, and it still works. However, it took me a second to realize that the menu item is only available when you right click in the body of the diff. It doesn’t work from the tabs across the top or the light or dark blue header rows for files and hunks. You need to use the green/red diff sections.

0 Likes