Would be nice to have a "git-checkpoint" command
From: Geert Bosch <hidden>
Date: 2016-08-11 20:15:26
(Just an idea, no code yet.)
NAME
----
git-checkpoint - Save current state of the repository
SYNOPSIS
--------
'git-checkpoint' [--stdout] [-n]
DESCRIPTION
-----------
This command generates trees/blobs for all files
in the current git repository, including untracked files
and directories and the .git directory itself, only excluding
.git/objects.
With no options given, tree id is saved in .git/UNDO
OPTIONS
-------
--stdout::
Write tree id of repository state to standard output, and
do not write in .git/UNDO
-n|--no-create::
Don't actually create new objects. Implies --stdout
(Discussion)
This could be used for implementing git-undo and git-redo commands.
Note that an implicit chain of undo commands is kept, by restoring
successive .git/UNDO files. Of course git-undo should save a .git/REDO
file. Ideally both operations would keep a nice undo/redo stack.
The reason for not using commits is that this not meant for keeping
history, just reverting mistakes. In particular, a prune will blow
away all older UNDOs keeping just the last, which is fine. Doing a
checkpoint should always succeed and never require user interaction.