Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
## git-filter-repo
- Stage a working area. These are somewhat throwaway directories and local git repos.
- clone both source and target repos.
### In source repo
We checkout a branch that we will filter against. We specify the path(s) that we want.
git checkout filter-source
git filter-repo --path ansible/ansible.cfg --path ansible/file.yml --path ansible/another-file.yml --refs refs/heads/filter-source --force
## In target repo
git checkout -b filter-target
git remote add repo-source ../testing
git fetch repo-source
git branch branch-source remotes/repo-source/filter-source
git merge branch-source --allow-unrelated-histories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment