Every repository with this icon (
Every repository with this icon (
Manual
This will eventually become the main (Home) page for Egg.
Egg: Emacs Got Git
Egg is not a git porcelain. It shares the
same goals with git aliases: make common git operations more
convenient to perform.
Egg will not provide binding for many git commands because:
- In the author’s humble opinion, some commands (such as
git init) are better invoked in a regular shell. - The author is a git newbie, and don’t know how to use some
advanced git commands (such asgit repack.) - The author is not familiar with some git commands because they
were never used by the author.
To use egg, simply compile the egg.el file then load the
egg.elc file. You can put the egg.elc file
somewhere in your emacs load-path and add (require
'egg) in your .emacs file.
Once activated, egg will turn on egg-minor-mode when a
file was opened in a git repository. However, the first thing should
be done after loading the first time is to to customize egg.
Customizations
M-x customize-group egg
Some (possibly) important customizations before using egg:
egg-git-command: this variable’s default value is
"git". It must be set to the appropriate incantation if
gitis not inexec-path.egg-patch-command: same issue as withegg-git-command.egg-git-rebase-subdir: git’s DOTEST directory keep changing from
one version of git to another. one must set this to the appropriate value for
the version of git currently used.egg-mode-key-prefix: key prefix for the
egg-minor-mode‘s commands. By default this was set to
the VC’s prefixC-x v, and thus,C-x v =
would invoke the commandegg-file-diff.egg-refresh-index-in-background: if enabled, egg will try
to refresh the index of the visited repositories when emacs has been
idle foregg-background-idle-periodseconds in order to
improve git commands’s responsiveness.egg-background-idle-period: the Emacs’s idle threshold
before egg start invoking background jobs.egg-confirm-next-action: if disabled, egg will not prompt
for confirmation inegg-next-action.egg-buffer-hide-section-type-on-start: this option let the
user customize the initial display of the deltas in many egg special
buffers. E.g. one can use this option to initially only show the
file-names and hide the details of the files in a delta.
Minor mode key-bindings
When egg-minor-mode is enabled in a file buffer, egg
provides many bindings for common git commands as well as egg specific
commands. The key-prefix shown in the below section assume that
egg-mode-key-prefix is C-x v.
| perform the next logical (DWIM style) action | |
| key | C-x v v |
| lisp | egg-next-action |
| see | egg-confirm-next-action customization option |
| note | with prefix (i.e. C-u C-x v v), ask for confirmation |
| edit the message and commit the staged changes | |
| key | C-x v c or C-x v w |
| lisp | egg-commit-log-edit |
| git | similar to git commit -e @ or @git commit -e --amend |
| note | with prefix (i.e. C-u C-x v c), this the upcoming commit will amend the tip commit. |
| launch the egg’s status-buffer for the current repo | |
| key | C-x v d or C-x v s |
| lisp | egg-status |
| git | similar to git status |
| show the branch’s history | |
| key | C-x v l |
| lisp | egg-log |
| git | similar to git log |
| note | with prefix (i.e. C-u C-x v l), show history of all refs |
| show the reflog | |
| key | C-x v L |
| lisp | egg-reflog |
| git | similar to git reflog |
| note | by default, show the reflog of HEAD. with prefix (i.e. C-u C-x v L), prompt for a ref |
| show the file’s history | |
| key | C-x v h |
| lisp | egg-file-log |
| git | similar to @git log — $file @ |
| note | by default, show the file history in the current branch. with prefix (i.e. C-u C-x v h), show the repo-wide file’s history |
| search file’s history for a string | |
| key | C-x v / |
| lisp | egg-file-log-pickaxe |
| git | similar to @git log |
| add the contents of the file into the index | |
| key | C-x v i |
| lisp | egg-file-stage-current-file |
| git | git add $file |
| checkout other version of the file | |
| key | C-x v o |
| lisp | egg-file-checkout-other-version |
| git | similar to @git checkout $sha1 — $file @ |
| note | with prefix (i.e. C-u C-x v o), do not prompt for confirmation |
| cancel file’s modifications | |
| key | C-x v u |
| lisp | egg-file-cancel-modifications |
| git | similar to @git checkout — $file @ |
| note | with prefix (i.e. C-u C-x v u), do not prompt for confirmation |
| note | egg-file-diff or egg-status provide a finer-grain (hunk by hunk) way to achieve the the same goal. However this command is quicker when no hunk-by-hunk editing was needed. |
| compare the file with the index or other versions | |
| key | C-x v = |
| lisp | egg-file-diff |
| git | similar to @git diff — $file @ |
| see | egg-file-ediff |
| note | with prefix (i.e. C-u C-x v =), prompt for base version |
| note | egg-status gives a repo-wide view of the work-dir vs the index |
| compare the file with the index or other versions using ediff | |
| key | C-x v e |
| lisp | egg-file-ediff |
| note | with prefix (i.e. C-u C-x v e), prompt for newer version |
| note | unlike egg-file-diff the current implementation of this command cannot edit the index |
| open file’s other version (read-only mode) | |
| key | C-x v ~ |
| lisp | egg-file-version-other-window |
| git | git show |
| note | by default, show the file’s contents in the index. with prefix (i.e. C-u C-x v =), prompt for a specific version |
| start a new branch from HEAD | |
| key | C-x v b |
| lisp | egg-start-new-branch |
| git | git checkout -b |
| show/hide history annotations | |
| key | C-x v a |
| lisp | egg-file-toggle-blame-mode |
| git | git blame |
| note | the current implementation of this command force the file into read-only mode when showing annotations. |
| grep current or older contents of tracked files | |
| key | C-x v g |
| lisp | egg-grep |
| git | git grep |
| note | need to load egg-grep.elc. |
| note | with single prefix (i.e. C-u C-x v g), use the symbol at point as the default grep term |
| note | with double prefix (i.e. C-u C-u C-x v g), prompt for a version |
Egg also provides a file-mode menu in the menubar which provides
access to the above commands.

History Annotations/Blame mode
egg-file-toggle-blame-mode
When blame-mode is on, the buffer is marked read-only. Disabling
blame-mode will restore the original read-only mode of the buffer.

Special Buffers
Egg creates various special-buffers for each repositories. Each buffer,
using different UI, provides different functionalities to the users.
- The delta manipulation buffers
- the status buffer
- the diff buffer
- The log editing buffers
- the commit buffer
- the tag buffer
- The commit browsing buffers
- the log buffer
- the file log buffer
- the reflog buffer
- the query or pickax buffer
- The stash buffer
The delta editor
Many special buffers embeds one or multiple diffs, i.e. one more
multiple sequence of file deltas. The local keymap of those text
blocks provide a delta-editor that let user maniuplate those diffs
hunk-by-hunk or file-by-file. E.g.
- If a delta sequence was a diff between the work-dir and the index
then the delta-editor would let the user moving hunk or file’s
contents from the work-dir to the index or remove the hunk or the
entire file delta from the work-dir. - If a delta sequence was a diff between the index and HEAD, then the
delta edtor would let the user moving hunk or file contents from the
index to the work-dir. - If a delta sequence was a diff between commits then the delta-editor
is in read-only mode. While it cannot move text in read-only mode,
the local keymap (implementing the delta editor) provide:- a convenient way to nagivate the delta sequence.
- the ability to hide or show a block of text to help the user
visualizing the global difference
The delta sequence (diff output) is treated as a hierarchical layout
by the local-keymap:
- A top-level section (unstaged, unmerged, staged, etc.) contains a
sequence of file deltas or diffs - A file delta (difference between a file in the work-dir and in the
index) contains a sequence of hunks - A hunks is the smallest unit that can be moved or removed by the
delta editor.
The key-bindings in the delta-editor are context-dependent base on the
position of the cursor in the delta sequence. By example:
| the cursor was in | the s key will |
| a diff header in the unstaged (or unmerged) section | stage the contents of the file |
| a diff header in the staged section | unstage the contents of the file in the index |
| a hunk header in the unstaged section | apply the hunk to the index |
| a hunk header in the staged section | reverse-apply the hunk to the index |
The common key bindings in a sequence of deltas
These bindings are available anywhere in a sequence of delta.
| move to the next block | |
| key | n |
| lisp | egg-buffer-cmd-navigate-next |
| move to the previous block | |
| key | p |
| lisp | egg-buffer-cmd-navigate-prev |
| hide/show current block’s details | |
| key | h or [mouse-2] |
| lisp | egg-section-cmd-toggle-hide-show |
| hide/show details of the current block’s sub-blocks | |
| key | H |
| lisp | egg-section-cmd-toggle-hide-show-children |

The common key bindings in a diff section (staged, unstaged or unmerged)
In addition to the previous bindings, the following bindings are
available anywhere in a diff header.
| open the file of this delta in Emacs’s other window | |
| key | RET |
| lisp | egg-diff-section-cmd-visit-file-other-window |
| open the file of this delta | |
| key | f |
| lisp | egg-diff-section-cmd-visit-file |
| show this delta in ediff | |
| key | = |
| lisp | egg-diff-section-cmd-ediff |
| popup menu for the delta | |
| key | [C-mouse-2] |
| note | the menu is context dependent |
The key bindings in a staged diff section
In addition to the two previous bindings, the following bindings are
available anywhere in a diff header of a staged changes section.
| show a 3-way diff of wdir,index and HEAD for the file in ediff3 | |
| key | = |
| lisp | egg-staged-section-cmd-ediff3 |
| unstage the file delta | |
| key | s |
| lisp | egg-diff-section-cmd-unstage |
| git | git reset -- $file |
The key bindings in an unstaged diff section
In addition to the common delta’s bindings and the
diff’s bindings, the following bindings are available anywhere in a
diff header of a unstaged changes section.
| show the file delta in ediff | |
| key | = |
| lisp | egg-unstaged-section-cmd-ediff |
| stage the file delta | |
| key | s |
| lisp | egg-diff-section-cmd-stage |
| git | git add $file |
| remove the file delta | |
| key | s |
| lisp | egg-diff-section-cmd-undo |
| git | git checkout -- $file |

The key bindings in an unmerged diff section
In addition to the common delta’s bindings and the
diff’s bindings, the following bindings are available anywhere in a
diff header of a unmerged changes section.
| show a 3-way diff (ours, theirs and work-dir) of the file delta in ediff3 | |
| key | = |
| lisp | egg-unmerged-section-cmd-ediff3 |
| stage the file delta | |
| key | s |
| lisp | egg-diff-section-cmd-stage |
| git | git add $file |
| remove the file delta | |
| key | s |
| lisp | egg-diff-section-cmd-undo |
| git | git checkout -- $file |
The Status Buffer.
The status buffer is launched via C-x v s keys from a
file-buffer when egg-minor-mode is enabled or via the
s key from most egg special buffers.

The primary usage for the status buffer:
- file-by-file or hunk-by-hunk index manipulation.
- stage a single unstaged hunk: add a single hunk from the a file to the index
- remove a single unstaged hunk: remove hunk of delta between the index and the file.
- unstage a single staged hunk: move a hunk from the index to the file.
- update the index with the (new) contents of a file.
- revert the contents of a file to match the index
- revert the contents of a file in the index to match the contents of the file in HEAD.
- resolve merge
- locate conflict marks in a file
- resolve merge using ediff3
- resolve/continue/skip/abort rebase
- locate conflict marks in a file
- resolve rebase using ediff3
- stash work-in-progress
- resolve conflict’s in stash applications
Status Buffer Screenshot during rebase

Status Buffer Organization
The status-buffer is organized in a hierarchical layout:
- General section
- Help block
- Unstaged Changes
- File 1
- File 1 Hunk 1
- File 1 Hunk 2
- …
- File 2
- …
- Staged Changes
- File 1
- File 1 Hunk 1
- File 1 Hunk 2
- …
- File…
- Untracked Files
- File 1
- …
Status Buffer’s key-bindings
The common key bindings in the egg status-buffer
| edit the message and commit staged changes | |
| key | c |
| lisp | egg-commit-log-edit |
| see | description |
| show the branch’s history | |
| key | l |
| lisp | egg-log |
| see | description |
| show the reflog | |
| key | L |
| lisp | egg-reflog |
| see | description |
| add contents of all modified (tracked) files to the index | |
| key | S |
| lisp | egg-stage-all-files |
| git | git add -u |
| note | by default, show the file’s contents in the index. with prefix (i.e. C-u C-x v =), prompt for a specific version |
| stash work-in-progress | |
| key | w |
| lisp | egg-buffer-stash-wip |
| git | git stash save |
| show all blocks/sub-blocks | |
| key | TBD |
| lisp | egg-buffer-show-all |
| hide all blocks/sub-blocks | |
| key | TBD |
| lisp | egg-buffer-hide-all |
| quit window | |
| key | q |
| lisp | quit-window |
| note | this command is not part of egg |
| note | this key-binding is common for many egg special buffers |
| redisplay buffer | |
| key | g |
| lisp | egg-buffer-cmd-refresh |
| note | this key-binding is common for many egg special buffers |







