Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Automatically open and close buffers when switching git branches, using git-emacs and desktop.el.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 README.rst
Octocat-spinner-32 gitch.el
README.rst

Gitch

With M-x 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.

M-x gitch-switch-repository is also provided, to provide the same functionality between repositories.

M-x 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.

Requirements:

Install

Download and place gitch.el in your .emacs.d/ directory. Then place this in your .emacs file:

  • (load-file "~/.emacs.d/gitch.el")
  • (setq gitch-current-repository "~/my-project/")

Usage:

  • M-x gitch-switch-branch:
    1. Close all current buffers.
    2. Stash changes.
    3. Switch to branch X.
    4. Pop stash if any for branch X.
    5. Open buffers that were previously open for branch X.
  • M-x gitch-switch-repository: Same as above but for repositories.

  • M-x gitch-save-buffers: Save buffers for the current branch.

  • M-x gitch-load-buffers: Load buffers for the current branch.

  • M-x gitch-new-branch: Save buffers, checkout new branch.

Something went wrong with that request. Please try again.