From: Nguyễn Thái Ngọc Duy Date: Sun, 09 Dec 2018 10:43:56 GMT Subject: [PATCH 01/24] doc: introduce new "backup log" concept Message-ID: <20181209104419.12639-2-pclouds@gmail.com> In-Reply-To: <20181209104419.12639-1-pclouds@gmail.com> A reflog file records changes of a certain ref over time. A backup log file does a similar job, but it records changes of some files over time. This is the main idea of it. This is added so that we can support undoing certain changes. For example, if you have carefully prepared your index with "git add -p" then accidentally do "git commit -a", your well crafted index is lost with no easy way to recover it. We could go the other way and make "git commit -a" complain loudly, but that has other bad side effects, the big one is we may complain too loudly at the wrong time and too often. This "do the right things (most of the time) but allow the user to undo when we get it wrong" approach seems more inline with how git handles other things. The current plan is to have three backup log files: - $GIT_DIR/index.bkl contains "interesting" changes made in the index. - $GIT_DIR/worktree.bkl contains "interesting" changes made in worktree. - $GIT_DIR/common/gitdir.bkl contains changes made in other files inside $GIT_DIR such as config, those in info/ directory, or reflog file deletion (aka the mystical reflog graveyard) All these only record "interesting" changes which will be defined later. But a few examples of them are: "git add -p" is interesting, but "git reset HEAD" is not. Similarly changes made in $GIT_DIR/config are usually interesting. This patch does none of that! It adds a new man page for a new plumbing command "git backup-log" which does show what this functionality looks like. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/config/core.txt | 5 ++ Documentation/git-backup-log.txt | 107 +++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 Documentation/git-backup-log.txt diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index d0e6635fe0..63b78cc048 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -316,6 +316,11 @@ This value is true by default in a repository that has a working directory associated with it, and false by default in a bare repository. +core.backupLog:: + If true, many commands will keep backup content in object database + before they modify some file. See linkgit:git-backup-log[1] for more + information. + core.repositoryFormatVersion:: Internal variable identifying the repository format and layout version. diff --git a/Documentation/git-backup-log.txt b/Documentation/git-backup-log.txt new file mode 100644 index 0000000000..98998156c1 --- /dev/null +++ b/Documentation/git-backup-log.txt @@ -0,0 +1,107 @@ +git-backup-log(1) +================= + +NAME +---- +git-backup-log - Manage backup log files + + +SYNOPSIS +-------- +[verse] +'git backup-log' [--id= | --path=] log [] [[--] ...] +'git backup-log' [--id= | --path=] cat [--before] [--hash] +'git backup-log' [--id= | --path=] diff [] +'git backup-log' [--id= | --path=] prune [--expire=