gitch-switch-branch, gitch will close your currently open file buffers and, after switching to another git branch, open all files that were open when you last visited this branch.
It uses desktop.el to save the list of buffers and reopen them later. It uses git-emacs for switching between branches.
gitch-switch-repository is also provided, to provide the same functionality between repositories.
gitch-new-branch can be used (but is not required) to save the current context and start a new branch.
Note that, for switching branches, gitch automatically stashes any pending changes and reapplies these automatically when switching back.
Download and place gitch.el in your .emacs.d/ directory. Then place this in your .emacs file:
(setq gitch-current-repository "~/my-project/")
- Close all current buffers.
- Stash changes.
- Switch to branch X.
- Pop stash if any for branch X.
- Open buffers that were previously open for branch X.
gitch-switch-repository: Same as above but for repositories.
gitch-save-buffers: Save buffers for the current branch.
gitch-load-buffers: Load buffers for the current branch.
gitch-new-branch: Save buffers, checkout new branch.