Skip to content

Instantly share code, notes, and snippets.

@a-bx
Created March 8, 2012 14:40
Show Gist options
  • Save a-bx/2001283 to your computer and use it in GitHub Desktop.
Save a-bx/2001283 to your computer and use it in GitHub Desktop.
Copy git repositories with all history
#Origin
$ git clone <origin repo>
$ cd <origin directory>
$ git remote rm origin
$ git filter-branch --subdirectory-filter ./ -- --all
$ git add .
$ git commit
$ pwd
#Target
$ 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
@messiisgreat
Copy link

Thank you very much!
It is very helpful!
But I have a simple question...
Is this different from git bare?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment