Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text, open files depending on the git branch

When I work, I always have 2 to 6/7/... branches where I edit usually completely different files. These branches usually don't exist for more than a few days, 2 or 3 weeks at most.

As I don't want to look for the files I modified or had opened last time I worked on one particular branch, I usually have as many ST opened as I have branches, and switch window each time I switch branches. It is still manageable, but I was wondering if anybody new of a package that would allow ST to track the branch I'm on, and restore the state it was in last time it was on this branch (I would settle for only opening the files that were opened, I don't really need to keep unsaved modifications).

Thank you for your time! I hope I was clear enough.

like image 321
Xælias Avatar asked Aug 13 '14 21:08

Xælias


1 Answers

I had forgotten about this post. I actually did write a plugin for ST: https://github.com/Xaelias/ST_Plugins/blob/master/BranchedWorkspace.py

Like I said in the comment, there is no option, and the behavior may not be perfect for everybody, but it worked well enough for me (and I don't really had time to improve it).

Some comments:

  • no option is available
  • this WILL erase any unsaved modification/new file you created if you switch branch, no confirmation
  • for the plugin to be aware of a branch, you need to leave it at least once while ST is running

If you have comments/questions/improvement, then Github is probably a better place but I will try to keep track of stuff happening here!

like image 73
Xælias Avatar answered Oct 29 '22 20:10

Xælias