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