Skip to content

Commit 9e20eef

Browse files
committed
FAQ.md: add an entry for how to specify paths
I keep getting surprised by the number of users specifying paths in ways other than how Git specifies paths. Add a FAQ entry I can point people to when I see it. Signed-off-by: Elijah Newren <[email protected]>
1 parent 6f79afc commit 9e20eef

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Documentation/FAQ.md

+37
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [Why did `git-filter-repo` rewrite commit hashes?](#why-did-git-filter-repo-rewrite-commit-hashes)
66
* [Why did `git-filter-repo` rewrite more commit hashes than I expected?](#why-did-git-filter-repo-rewrite-more-commit-hashes-than-i-expected)
77
* [Why did `git-filter-repo` rewrite other branches too?](#why-did-git-filter-repo-rewrite-other-branches-too)
8+
* [How should paths be specified?](#How-should-paths-be-specified)
89
* [Help! Can I recover or undo the filtering?](#help-can-i-recover-or-undo-the-filtering)
910
* [Can you change `git-filter-repo` to allow future folks to recover from `--force`'d rewrites?](#can-you-change-git-filter-repo-to-allow-future-folks-to-recover-from---forced-rewrites)
1011
* [Can I use `git-filter-repo` to fix a repository with corruption?](#Can-I-use-git-filter-repo-to-fix-a-repository-with-corruption)
@@ -90,6 +91,42 @@ comes with the risk that one branch now has a different version of some
9091
commits than other branches do; usually, when you rewrite history, you
9192
want all branches that depend on what you are rewriting to be updated.
9293

94+
## How should paths be specified?
95+
96+
Arguments to `--path` should be paths as Git would report them, when run
97+
from the toplevel of the git repository (explained more below after some
98+
examples).
99+
100+
**Good** path examples:
101+
* `README.md`
102+
* `Documentation/README.md`
103+
* `src/modules/flux/capacitor.rs`
104+
105+
You can find examples of valid path names from your repository by
106+
running either `git diff --no-relative --name-only` or `git log
107+
--no-relative --name-only --format=""`.
108+
109+
The following are basic rules about paths the way that Git reports and uses
110+
them:
111+
* do not use absolute paths
112+
* always treats paths as relative to the toplevel of the repository
113+
(do not add a leading slash, and do not specify paths relative to some
114+
subdirectory of the repository even if that is your current working
115+
directory)
116+
* do not use the special directories `.` or `..` anywhere in your path
117+
* do not use `\`, the Windows path separator, between directories and
118+
files; always use `/` regardless of platform.
119+
120+
**Erroneous** path examples (do **_NOT_** use any of these styles):
121+
* `/absolute/path/to/src/modules/program.c`
122+
* `/src/modules/program.c`
123+
* `src/docs/../modules/main.java`
124+
* `scripts/config/./update.sh`
125+
* `./tests/fixtures/image.jpg`
126+
* `../src/main.rs`
127+
* `C:\absolute\path\to\src\modules\program.c`
128+
* `src\modules\program.c`
129+
93130
## Help! Can I recover or undo the filtering?
94131

95132
Sure, _if_ you followed the instructions. The instructions told you to

0 commit comments

Comments
 (0)