I'm reading about what git filter-repo
can do because I want to do a small experiment with it.... I have this repo where I only want to get the history of one directory from, say.... master..... but I don't want to work on master. I would like to create a new branch, say filter-repo-test
and let git filter-repo
run its magic on this branch alone. I'm reading the manual but I don't see an option to specify only a given branch. Is it possible?
Asked
Active
Viewed 6,352 times
12

eftshift0
- 26,375
- 3
- 36
- 60
2 Answers
11
The 'Miscellaneous Options' includes --refs
--refs <refs+>
Limit history rewriting to the specified refs. Implies
--partial
.
In addition to the normal caveats of--partial
(mixing old and new history, no automatic remapping ofrefs/remotes/origin/*
torefs/heads/*
, etc.), this also may cause problems for pruning of degenerate empty merge commits when negative revisions are specified.
And... it will move tags, as I documented in "Git Subdirectory Filter with tags", which does uses --refs
, as an example.
As Ryan Wheale notes in the comments:
You should be able to use the branch name to limit the filtering to the branch.
Again, take note of the caveats of--partial
.--refs filter-repo-test

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
Just a note for others: you should be able to use the branch name to limit the filtering to the branch. Again, take note of the caveats of `--partial`: `--refs filter-repo-test` – Ryan Wheale Jan 06 '23 at 21:23
0
Never mind, I just found it. It was right under my nose. It is defined with --refs

eftshift0
- 26,375
- 3
- 36
- 60