To manage yarn workspaces I am copying the pertinent subfolders into temporary folders and push them into their respective git repositories
To setup these repositories I am using git clone
, which downloads everything and sets up the origin and remote configuration (and then copy files)
Can I skip the downloading of the repo folders?
Would this work?
git clone --filter=blob:none --no-checkout <repo>
EDIT
The usual way would be (as said by @edd34 and @pallgeuer below) with git init
and remote add origin
, but with the git clone
above is only one line
-> what are the differences? What is achieved with this approach? And if incorrect, is there any way to get the same (provided a remote already exists) with git clone
?
The command:
$ git clone --no-checkout <repo> $(pwd)
will correctly clone only the .git
folder, and no files, in the current working directory.
This should be equivalent to the more standard workflow:
$ git init
$ git remote add origin <url>
$ git fetch origin
You end up with the .git
folder in your working directory and don't perform the HEAD checkout.