Sublime Forum

Stash accidents in sublime merge best way to resolve?

#1

I keep doing this by accident:

I do alt + tab to go into merge forget to push ctrl + s to save file in sublime text, accidently creating a stash in sublime merge, the only way I have found to get rid of the stash is to ‘drop stash’ but this then deletes all my work in the other file, not usually an issue as most the time I can do ctrl + z in sublime text to undo everything. Is there a better and easier less risky way to get rid of an accidental stash in sublime merge?

2 Likes

#2

Actually think I worked it out, is it just pop stash I need to do?

0 Likes

#3

You got it. stash pop is correct then.

0 Likes

#4

Thanks for that

0 Likes

#5

How do I disable the stash keyboard shortcut? I keep pressing Ctrl-S by accident :wink:

2 Likes

#6

Sublime Merge supports the same set of configuration files as Sublime Test.

You can create a Default.sublime-keymap (or edit the) file in the Packages/User directory. The following dummy key binding will disable the git stash call.

[
    {
        "keys": ["ctrl+s"],
        "command": "",
    },
]
2 Likes

#7

In order to quickly find the correct path of SM’s key bindings configuration file, follow the following steps:

  1. Click on Main Menu > Preferences > Browse Packages…
  2. Open or create the Users folder
  3. Open or create the Default.sublime-keymap using your favourite (Sublime) Text Editor.
  4. Paste the content from the previous post or add the relevant parts.
1 Like

#8

Somehow, I’m tripping on this several times a day this week, after several years of never running into it. I’m not sure what’s changed about me, but this is SUPER ANNOYING.

I’ll be changing my config to remove [Command-S] from Sublime Merge, but I’ll suggest that this is a really poor choice of default keymapping. There is isn’t a program in the world that uses [Command-S] / [Ctrl-S] for anything other than “Save File”.

You could argue that git stash is conceptually a “Save” within a repo…but I don’t think that holds much water. I suspect it was mapped just because “Stash” stars with “S”.

I recently find myself hitting [Command-S] after typing a commit message and intending to make a commit…I don’t know why. Instead, I get a stash with a side of confusion. It would be a better user experience if nothing happened in that case.

I recommend that this keymapping be removed as the default in an upcoming update.

1 Like