GIT Bare Clone

?
R
Bash

Clone an existing GIT based project into a new one. (it will copy all branches and all logs).

1# move to a scratch dir
2mkdir foo; cd foo 
3
4# Make a bare clone of the repository
5git clone --bare https://github.com/exampleuser/old-repository.git
6cd old-repository.git
7
8# Mirror push to the new repository
9git push --mirror https://github.com/exampleuser/new-repository.git
10
11# Remove our temporary local repository
12cd ..
13rm -rf old-repository.git  
14
15# Set remote  upstreams (if not automatically set)
16git branch --set-upstream-to=origin/master master
17git branch --set-upstream-to=origin/develop develop

Created on 7/31/2017