threads / discuss / 43700

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

Subject: Would be nice to have a "git-checkpoint" command

## tl;dr

One message between Oct 24, 2006 and Oct 24, 2006.

replies: 0people: 1as markdown or json

Geert Bosch· Oct 24, 2006, 20:36 UTC · lore
(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.

← back to recent threads