# Would be nice to have a "git-checkpoint" command

1 messages from 2006-10-24 to 2006-10-24. Participants: Geert Bosch.
Thread: https://gitlist.dev/t/43700

## Geert Bosch, 2006-10-24 20:36

Subject: Would be nice to have a "git-checkpoint" command
Message-ID: <8F8E6877-19F5-47F1-B7B6-E369BD39FC3E@adacore.com>
URL: https://gitlist.dev/e/8F8E6877-19F5-47F1-B7B6-E369BD39FC3E%40adacore.com

```
(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.


```
