~1 min read|
Frequently, I find myself wanting to create a temporary clone of a repository. This often happens when something’s gone wrong and I want to isolate the issue with a fresh install.
My workflow for this used to include creating a new temporary directory and then cloning the project into the new folder.
The result was something like this:
$ pwd /Users/stephen/code $ mkdir temp $ cd temp $ git clone <repository>
It turns out that
git clone actually facilitates this operation much more simply with an optional
$ git clone <repository> [<directory>]
The directory parameter works by allowing you to target a directory instead of taking the repository name as the title.
This might look like:
$ git clone firstname.lastname@example.org:original-repository.git $ git clone email@example.com:original-repository.git clean-install-of-repository
The result is a cleaner file structure and a few saved keystrokes.
$ pwd /Users/stephen/code $ tree -L 1 . ├── original-repository └── clean-install-of-repository
Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!