Copy a git repository with all history
In case you need to copy a git repository with all it's history (when you are migrating for instance) do the following.
First checkout the origin repository:
$ git clone <origin repo> $ cd <origin directory> $ git remote rm origin $ git filter-branch --subdirectory-filter ./ -- --all $ git add . $ git commit $ pwd
Then copy all to the target repository as follows:
$ git clone <target repo> $ cd <target directory> $ git remote add origin-repo <origin directory> $ git pull origin-repo master $ git remote rm origin-repo $ git push











