Sublime Forum

Checkout previous active branch

#1

Hello,

I was wondering whether Sublime Merge supports something like git checkout - (this checks out the previous active branch).
E.g. if you’re on master you can do git checkout feature-branch, then a git checkout - will get you back to master (and another git checkout - will get you again to feature-branch).
It’s kind of analogous to cd - and the directory stack, it’s handy when switching between master and another branch

Can you do something like that with SM? Seemingly I couldn’t find any other thread on the topic …

0 Likes

#2

According to https://www.sublimemerge.com/docs/custom_commands

You can create a custom git command like

[
    {
        "caption": "Checkout Previous Active Branch",
        "command": "git",
        "args": {"argv": ["checkout", "-"]},
    },
]

The only question is where this menu item should be put at.

  • Branch Folder.sublime-menu
  • Branch Section.sublime-menu
  • Branch.sublime-menu
  • Default.sublime-commands (the command palette)
0 Likes

#3

While I guess @jfcherng answered your question - thanks for teaching me git checkout -, I didn’t know about this! :slight_smile:

0 Likes

#4

Got it. Thanks a lot!

0 Likes