git-wip-timemachine
is a modified version of
git-timemachine
by Peter
Stiernström that allows you to browse
git-wip
versions of files from
Emacs.
git-wip-timemachine
is on MELPA. To
start using it, follow these steps:
-
If you haven't already, set up
git-wip
:-
Clone the
git-wip
package to your$HOME
directory:$ cd $ git clone https://github.com/itsjeyd/git-wip
If you decide to clone to a different directory and that directory is not part of your
exec-path
in Emacs, you'll need to add the following code to your init-file (to make sure Emacs can find thegit-wip
script):(add-to-list 'exec-path "/path/to/git-wip")
-
Add the following code to your init-file:
(load "/path/to/git-wip/emacs/git-wip.el")
From now on, every time you save a file that is part of a
git
repository, Emacs will automatically create a WIP commit by calling out togit-wip
for you.
-
-
Install
git-wip-timemachine
via:M-x
package-install
RETgit-wip-timemachine
RET
Issue M-x git-wip-timemachine
to browse through WIP
versions of a file.
Use the following keys to navigate WIP versions of the file:
- . Visit current (latest) WIP version.
- > Visit current (latest) WIP version.
- < Visit oldest WIP version (equivalent to merge base of current branch and associated WIP branch if merge base introduces changes to current file).
- p Visit previous WIP version.
- n Visit next WIP version.
- g Visit nth WIP version.
- w Copy the abbreviated hash of the current WIP version.
- W Copy the full hash of the current WIP version.
- q Exit the time machine.
If you want, you can of course bind git-wip-timemachine
to a key
sequence of your choice.
Finally, there's also git-wip-timemachine-toggle
which does exactly
what its name suggests: If the timemachine is on, calling this command
will turn it off (and vice versa).
lispy-mode
interferes with the
default bindings of git-wip-timemachine
. If it is on when you start
the timemachine, it will be turned off automatically (and become
active again when you exit the timemachine).
If you use magit
, you might be
interested in having your WIP commits listed in the *magit-log*
buffer. Follow these steps to do this interactively:
-
Hit l to bring up the menu for logging.
-
Enter
-al
to enable the--all
switch. -
Hit l (or L, if you want to see stats as well).
If you want to enable the --all
switch by default, you can add the
following code to your init-file:
(defun magit-log-all ()
(interactive)
(magit-key-mode-popup-logging)
(magit-key-mode-toggle-option 'logging "--all"))
(define-key magit-mode-map (kbd "l") 'magit-log-all)
Note that while git-wip-timemachine
only considers WIP commits that
introduce changes to the file it was called from, magit
will show
all WIP commits by default (irrespective of the file(s) they touch).