Skip to content

Commit d87b665

Browse files
committed
git-filter-repo.txt: connect --no-local and fresh clones more thoroughly
Signed-off-by: Elijah Newren <[email protected]>
1 parent 469a3e1 commit d87b665

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

Documentation/git-filter-repo.txt

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Also, it's worth noting that there is an important safety mechanism:
5858

5959
* abort if run from a repo that is not a fresh clone (to prevent
6060
accidental data loss from rewriting local history that doesn't
61-
exist anywhere else)
61+
exist anywhere else). See <<FRESHCLONE>>.
6262

6363
For those who know that there is large unwanted stuff in their history
6464
and want help finding it, this command also
@@ -346,7 +346,9 @@ that is an imperfect but quite reasonable proxy: "Is this repository a
346346
fresh clone?" Unfortunately, that is also a question we can't get a
347347
perfect answer to; git provides no way to answer that question.
348348
However, there are approximately a dozen things that I found that seem
349-
to always be true of brand new clones, and I check for all of those.
349+
to always be true of brand new clones (assuming they are either clones
350+
of remote repositories or are made with the `--no-local` flag), and I
351+
check for all of those.
350352

351353
These checks can have both false positives and false negatives.
352354
Someone might have a perfectly good backup of their repo without it
@@ -355,22 +357,24 @@ know that. Conversely, someone could look at all things that
355357
filter-repo checks for in its safety checks and then just tweak their
356358
non-backed-up repository to satisfy those conditions (though it would
357359
take a fair amount of effort, and it's astronomically unlikely that a
358-
repo that isn't a fresh clone happens to match all the criteria). In
359-
practice, the safety checks filter-repo uses seem to be really good at
360-
avoiding people accidentally running filter-repo on a repository that
361-
they shouldn't be running it on. It even caught me once when I did
362-
mean to run filter-repo but was in a different directory than I
363-
thought I was.
364-
365-
In short, it's perfectly fine to use "--force" to override the safety
360+
repo that isn't a fresh clone randomly happens to match all the
361+
criteria). In practice, the safety checks filter-repo uses seem to be
362+
really good at avoiding people accidentally running filter-repo on a
363+
repository that they shouldn't be running it on. It even caught me
364+
once when I did mean to run filter-repo but was in a different
365+
directory than I thought I was.
366+
367+
In short, it's perfectly fine to use `--force` to override the safety
366368
checks as long as you're okay with filter-repo irreversibly rewriting
367369
the contents of the current repository. It is a really bad idea to
368-
get in the habit of always specifying --force; if you do, one day you
369-
will run one of your commands in the wrong directory like I did, and
370-
you won't have the safety check anymore to bail you out. Also, it is
371-
definitely NOT okay to recommend --force on forums, Q&A sites, or in
372-
emails to other users without first carefully explaining that --force
373-
means putting your repositories' data at risk.
370+
get in the habit of always specifying `--force`; if you do, one day
371+
you will run one of your commands in the wrong directory like I did,
372+
and you won't have the safety check anymore to bail you out. Also, it
373+
is definitely NOT okay to recommend `--force` on forums, Q&A sites, or
374+
in emails to other users without first carefully explaining that
375+
`--force` means putting your repositories' data at risk. I am
376+
especially bothered by people who suggest the flag when it clearly is
377+
NOT needed; they are needlessly putting other peoples' data at risk.
374378

375379
[[VERSATILITY]]
376380
VERSATILITY

0 commit comments

Comments
 (0)