################################################################################ # Moving files from one repo to another: # http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/ # filter one directory git clone cd git remote rm origin git filter-branch --subdirectory-filter -- --all mkdir mv * git add . git commit # pull into another repo git clone cd git remote add repo-A-branch git pull repo-A-branch master git remote rm repo-A-branch ################################################################################ # In order to remove individual files: # http://stackoverflow.com/a/10524661 git filter-branch -f --prune-empty --index-filter "git rm --cached --ignore-unmatch remove1.txt remove2.txt" # in order to remove history for older files that are no longer part of the repo, find all files that ever existed: git log --pretty=format: --name-only --diff-filter=A | sort -u # keep wanted files and remove newlines git log --pretty=format: --name-only --diff-filter=A | sort -u | grep -v "keep1.txt\|keep2.txt" | tr "\\n" " " # then feed that list into above command ################################################################################ # In order to move files to new directories while maintaining history: # https://gist.github.com/emiller/6769886