Skip to content

Instantly share code, notes, and snippets.

@changusmc
Created April 20, 2022 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save changusmc/8c72c748b193f0ad6f4d2cb932d38043 to your computer and use it in GitHub Desktop.
Save changusmc/8c72c748b193f0ad6f4d2cb932d38043 to your computer and use it in GitHub Desktop.
Creates a new repo fast by creating a local mirror
# Create a mirror from your existing source directory
git clone -v --mirror $HOME/dev/source_repo $HOME/dev/source_repo_mirror
# Updating existing repository mirror to find commit HEAD
git --git-dir $HOME/dev/source_repo_mirror remote set-url origin $REMOTE_URL
git --git-dir $HOME/dev/source_repo_mirror fetch origin main
# Create your new copy
git clone -v --reference ~/dev/source_repo_mirror -- $REMOTE_URL source_repo2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment