IMPORTANT
Without --mirror , the clone will not be a full backup. Any line not displayed in git branch -r will be removed from the clone.
Simple demonstration
Witness a simple repo.
$ git init G $ cd G $ for f in 1 2 3 4; do date >1 && git add 1 && git commit -m $f; sleep 1.1; done $ git log --oneline --graph --all --decorate * 3c111bd (HEAD -> master) 4 * a08fea4 3 * d5c8d73 2 * 802856b 1
Add thread:
$ git checkout d5c8d73 HEAD is now at d5c8d73... 2 $ git branch starts-at-2 $ git checkout starts-at-2 Switched to branch 'starts-at-2' $ for f in 1 2 3 4; do date >1 && git add 1 && git commit -m 2-$f; sleep 1.1; done $ git log --oneline --graph --all --decorate * 6bb05bf (HEAD -> starts-at-2) 2-4 * fe1b635 2-3 * a9323fb 2-2 * 33502af 2-1 | * 3c111bd (master) 4 | * a08fea4 3 |/ * d5c8d73 2 * 802856b 1
Clone the repo.
$ cd .. $ $ git clone G G2 Cloning into 'G2'... $ cd G2 $ git log --oneline --graph --all --decorate * 6bb05bf (HEAD -> starts-at-2, origin/starts-at-2, origin/HEAD) 2-4 * fe1b635 2-3 * a9323fb 2-2 * 33502af 2-1 | * 3c111bd (origin/master) 4 | * a08fea4 3 |/ * d5c8d73 2 * 802856b 1
Fine Clone again.
$ cd .. $ git clone G2 G3 $ cd G3 $ git log --oneline --graph --all --decorate * 6bb05bf (HEAD -> starts-at-2, origin/starts-at-2, origin/HEAD) 2-4 * fe1b635 2-3 * a9323fb 2-2 * 33502af 2-1 * d5c8d73 2 * 802856b 1
Urk.
bobbogo Nov 22 '17 at 13:27 2017-11-22 13:27
source share