Sublime Forum

Git change branch like project switching

#1

Iā€™d love it if I could switch branches in a project and have it act like switching a project in Sublime. Meaning, Iā€™d like to have a modal dropdown to choose which branch Iā€™m switching to and when switching, have it change which files are open to whatever the last state was when I was in that branch. How much work would something like this be?

0 Likes

#2

I think itā€™s more likely that a plugin does this, rather than ST core. Though it would be done with the quick panel rather than a modal dropdown.

0 Likes

#3

Just found myself wanting this, nice to see thereā€™s interest in it. Couldnā€™t find anything which does it, so I might create a plugin over the summer if I find the time.

I use Git from the command line though, so I was thinking that the Sublime plugin would just monitor the current branch and silently update which files are open when the branch changes, rather than using a Sublime command to trigger branch changes. I guess both could be supported, with the option to switch between the two as a preference.

Youā€™d want to preserve as much state as possible ā€“ preserving open files is essential, but scroll position in each file would be nice as well. Never looked at the Sublime API so Iā€™m not sure how difficult that would be.

0 Likes

#4

There are already many plugins for Git support.
I think the easiest way would be to fork one of them and implement the missing ā€œsave workspaceā€ feature.

0 Likes

#5

im currently workin on that kind of plugin, i think i finish it in month or so.
There are missing feature in sublime api - save workspace and change workspace (but functionality in sublime text is ready).
if i could use this things through API i would finish that plugin in a day or two, but i needed to implement this myself. :frowning:

0 Likes

#6

Did you ever find those APIā€™s I"m really interested in having easy switching of workspaces.

0 Likes

#7

Did you get anywhere with this?

Is there an api to ā€œSave Workspace Asā€¦ā€?
Is there an api to ā€œQuick Switch Workspaceā€?
Is there an api to list available Workspaces?
Is there an api to delete a .sublime-workspace file?

0 Likes