Skip to content

Instantly share code, notes, and snippets.

@Clumsy-Coder
Created September 10, 2023 21:14
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 Clumsy-Coder/a452638c16766d91fc66e6185bd2a19a to your computer and use it in GitHub Desktop.
Save Clumsy-Coder/a452638c16766d91fc66e6185bd2a19a to your computer and use it in GitHub Desktop.
Convert cloned repo to a bare repo
#!/usr/bin/env zsh
# convert cloned repo into bare repo.
# this to allow the usage of git worktrees
# obtained from
# https://stackoverflow.com/a/2200662/3053548
cd repo
mv .git ../repo.git # renaming just for clarity
cd ..
rm -fr repo
cd repo.git
git config --bool core.bare true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment