How is this different from git clone with --mirror option ?

On Thursday, December 17, 2015 at 9:46:23 PM UTC+5:30, Konstantin Khomoutov 
> On Thu, 17 Dec 2015 04:40:34 -0800 (PST) 
> <javascript:> wrote: 
> > I am looking for a mechanism to completely backup my git repository . 
> > The final goal is to take a backup on Tape . I know we have many 
> > alternatives like creation of a git bundle or git archive , 
> > but could you please suggest the best way wherein all references 
> > ( remote branchs, tags ) are also preserved . 
>   git init --bare foo.git 
>   cd foo.git 
>   git fetch $source_repo_url 'refs/*:refs/*' 
> The last encantation uses the so-called "refspec" which instructs Git 
> to fetch everything from the source repo and re-create the same refs 
> (heads, tags, notes, whatever else there might be) in the local repo. 
> The resulting repo can then be backed up to tape. 
> If you don't want to re-clone each time, the step (1) should be done 
> only once and the two remaining steps should be repeated before each 
> backup takes place and look like this: 
>   cd foo.git 
>   git fetch $source_repo_url '+refs/*:refs/*' 
> Notice the '+' char in the "refspec": it tells Git to forcibly replace 
> everything in the local repo which would otherwise produce a conflict. 
> If this for some reason might matter to you, you might augment the 
> fetching operation with repacking the repository using 
>   git gc --aggressive 
> which will move most of the "loose" objects into the so-called "pack 
> files".  On slower filesystems (such as NTFS) this might speed up 
> copying a bit.  But I'm skeptical about whether this would be 
> really noticeable. 

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to