From 8968718cdd7c289e63e25c0ef964aeadd169b384 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Wed, 5 Nov 2014 23:21:58 -0800 Subject: git: copying files btwn repos w/ history --- software/git.page | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'software') diff --git a/software/git.page b/software/git.page index 3f4e3ef..ffad5ed 100644 --- a/software/git.page +++ b/software/git.page @@ -18,3 +18,21 @@ copy ``hooks/post-update.sample`` to ``hooks/post-update``. To add links from gitweb, add to the ``@git_base_url_list`` list in the configuration file. + +Copying Files Between Repositories with History +------------------------------------------------ + +Create a branch with only python files (slow; ignore the very verbose "won't +delete directory" output): + + git checkout -b filtered-commits + git filter-branch -f --prune-empty --tree-filter 'find . -not -iname "*.py" -exec rm {} \;' filtered-commits + +In the receiving repo: + + git pull path/to/source/repo + +See also: + +http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/ +http://superuser.com/questions/164362/git-keep-changelog-for-file-when-moving-to-a-different-repository -- cgit v1.2.3