git-annex-filter-branch(1)
β¨ git-annex-filter-branch β¨
okay so bestie, this is git-annex-filter-branch from the General Commands Manual section of the git-annex fam π β it's the picky-eater version of your git-annex branch. Like, it only takes the bites you tell it to.
πΈ NAME πΈ
git-annex-filter-branch β filter information from the git-annex branch
π SYNOPSIS π
git annex filter-branch [...]
π¦ DESCRIPTION π¦
So what this does: it copies selected info from the git-annex branch into a git commit object, and then it spits out that commit's hash. That git commit can be transported to another git repository, and given a branch name like "foo/git-annex", and over there git-annex will automatically merge it into its own git-annex branch. Basically it lets you publish some of your git-annex branch info without publishing the whole entire thing. no cap π₯
Other ways to avoid publishing info from a git-annex branch, or to remove info from it, include git-annex-forget(1), the annex.private git config, and the --private option to git-annex-initremote(1). Those are much easier to use β but this one gives you full control for those who need it. main character energy π
With no options at all, no information at all will be included from the git-annex branch. You use options to specify what to include. And good news: all options can be specified multiple times. π
When the repository contains information about a private repository (because annex.private is set, or because git-annex initremote --private was used), that private information will be included when it's allowed by the options β even though it is not recorded on the git-annex branch. π
When a repository was created with git annex initremote --sameas=foo, its information gets included when the information for foo is included, and excluded when foo is excluded. besties stick together fr fr π«Ά
When a special remote is configured with importtree=yes or exporttree=yes, normally the git tree corresponding to the repository is included in the git-annex branch, so that it doesn't get garbage collected by git gc. Those trees are not included when filtering the git-annex branch. Usually that won't cause any problems, but if such a tree does get garbage collected, it will prevent accessing files on the special remote β until the next time a tree is imported or exported to it. β οΈ
β¨ OPTIONS β¨
pathβ include information about all keys of annexed files in the path.- file matching options β the
git-annex-matching-options(1)can be used to specify which files in a path to include. --branch=refβ include information about keys referred of annexed files in the branch or treeish.--key=keyβ include information about a specific key.--allβ include information about all keys. everything. the whole vibe. π--include-key-information-for=repoβ when including information about a key, also include information specific to this repository. The repository can be specified with a uuid or the name of a remote. This option can be used repeatedly to include several repositories. π--include-all-key-informationβ include key information for all repositories, except any excluded with the--exclude-key-information-foroption.--exclude-key-information-for=repoβ when including information about a key, exclude information specific to this repository. The repository can be specified with a uuid or the name of a remote. This option can be used repeatedly to exclude several repositories. π--include-repo-config-for=repoβ include configuration specific to this repository. The repository can be specified with a uuid or the name of a remote.
This includes the configuration of special remotes, which may include embedded credentials, or encryption parameters. It also includes trust settings, preferred content, etc. It does not include information about any git-annex keys. This option can be used repeatedly to include several repositories.
--include-all-repo-configβ include the configuration of all repositories, except for any excluded with the--exclude-repo-config-foroption.--exclude-repo-config-for=repoβ exclude configuration specific to this repository. The repository can be specified with a uuid or the name of a remote. This option can be used repeatedly to exclude several repositories.--include-global-configβ include global configuration, that is not specific to any repository.
This includes configs stored by git-annex-numcopies(1), git-annex-config(1), etc.
π EXAMPLES π
π splitting a subdir out
You have a big git-annex repository and you're splitting the directory "foo" out, to make a smaller repository. You want the smaller repo's git-annex branch to contain all the information about remotes and other configuration, but only information about keys in that directory.
git-annex filter-branch foo --include-all-key-information \
--include-all-repo-config --include-global-config
That only includes information about the keys that are currently in the directory "foo", not keys used by old versions of files. To also include information about the version of the subdir in tag "1.0", add the option --branch=1.0:foo. β
π sharing key info but not remote config
Your repository has a special remote "bar", and you want to share information about which annexed files are stored in it, but without sharing anything about the configuration of the remote.
git-annex filter-branch --all --include-all-key-information \
--include-all-repo-config --exclude-repo-config-for=bar \
--include-global-config
π SEE ALSO π
π AUTHOR π
Joey Hess <id@joeyh.name>
okay that's the whole thing, you're literally a git-annex branch surgeon now, slay π
β¨ this came from the git-annex General Commands Manual, page git-annex-filter-branch(1), so if you forget anything just yell for the manpage again bestie π«Άππ¦
π¦ where this page comes from
- alpine 3.24: git-annex-doc 10.20261026-r0 Β· AGPL-3.0-or-later
- arch rolling: git-annex 10.20261026-2 Β· AGPL-3.0-only
- debian trixie: git-annex 10.20250416-2 Β· AGPL-3.0-or-later
- debian trixie: git-annex 10.20250416-2+deb13u1 Β· AGPL-3.0-or-later
- epel 10: git-annex 10.20250320-1.el10_0 Β· AGPL-3.0-or-later
- fedora 43: git-annex 10.20250630-4.fc43 Β· AGPL-3.0-or-later
- fedora 43: git-annex 10.20250929-5.fc43 Β· AGPL-3.0-or-later
- fedora 44: git-annex 10.20260115-1.fc44 Β· AGPL-3.0-or-later
- nixos 26.05: git-annex 10.20260421
- nixpkgs unstable: git-annex 10.20260421
- opensuse-leap 16.0: git-annex 10.20250828-bp160.1.1 Β· AGPL-3.0-or-later AND GPL-3.0-or-later AND BSD-2-Clause AND MIT AND GPL-2.0-only
- opensuse-leap 16.0: git-annex 10.20250828-bp160.1.1 Β· AGPL-3.0-or-later AND GPL-3.0-or-later AND BSD-2-Clause AND MIT AND GPL-2.0-only
- opensuse-leap 16.0: git-annex 10.20250828-bp160.1.1 Β· AGPL-3.0-or-later AND GPL-3.0-or-later AND BSD-2-Clause AND MIT AND GPL-2.0-only
- ubuntu noble: git-annex 10.20240129-1build1 Β· AGPL-3.0-or-later
- ubuntu questing: git-annex 10.20250721-1
- ubuntu resolute: git-annex 10.20251029-1ubuntu1 Β· AGPL-3.0-or-later
- ubuntu stonking: git-annex 10.20251029-1ubuntu1 Β· AGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms