Make a full copy of a git repo
This is a pretty common problem with git, and there are various answers, but most of them involve either creating and running a bash script, or manually checking out each branch. Here is a way to do this purely through simple git commands:
mkdir repo
cd repo
git clone --bare path/to/repo.git .git
git config unset core.bare
git reset --hard
At this point you have a complete copy of the remote repo with all of it's branches (verify with git branch
). You can use --mirror
instead of --bare
if your remote repo has remotes of its own.
Written by Jacob Fike
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#