I'm very new to emacs, but from what I understand it should be able to do almost anything.

Something I have wanted in my IDE for a long time, is a bunch of open files, based on a git branch. I do dev work on a large software project and use feature branches. I constantly switch between different branches, and I will usually close all the open files that are not associated with the current thing I'm working on.

The problem is, when I switch back to a branch to do some more work, I can never remember what files I was working with. Basically I am after something like this:

  1. I am working on some branch X
  2. I switch to some other branch Y. At this point all the files I had open are closed, and their names are saved ~somewhere~
  3. I do some work on Y and switch back to X. All the files I was working on are closed and names saved
  4. When branch X is checked out, all the files I had open from the last time I was working on X are opened

Is something like this possible with emacs? Does it already exists? Would it be hard to implement?

1 Answer 1


I don't have the rep for a comment so sorry for the not really an answer answer:

I'd recommend looking into sessions since you then can save (and load) your different sessions and name them after the branch you're working on. That will solve the problem with remembering which files you had open.

Personally I tend to not close emacs but just refresh the file after I've done a branch switch. Might not be applicable for you if you have a whole lot of files open.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.