Syntax
Description
Therepo new command creates a new local Git repository under your $REPO_BASE_DIR. It initializes the repository with git init and navigates to the newly created directory.
Arguments
The path for the new repository relative to
$REPO_BASE_DIR. The path is cleaned and normalized:- Protocol prefixes are removed if present
.gitsuffix is automatically stripped- Simple names like
my-projectare used as-is
Examples
Create a simple project
$REPO_BASE_DIR/my-project/
Create with nested path
$REPO_BASE_DIR/experiments/machine-learning/
Create using the alias
Behavior
New Repository
When creating a new repository:- Creates directory:
$REPO_BASE_DIR/my-app/ - Runs:
git init $REPO_BASE_DIR/my-app/ - Changes to the new directory
Repository Already Exists
If a repository with the same path already exists:Parent Directories
Parent directories are created automatically if they don’t exist:deep/, deep/nested/, deep/nested/path/
Directory Structure
After runningrepo new my-project, the structure is:
Related Commands
- repo get - Clone an existing repository
- repo goto - Navigate to the repository later
- repo convert - Convert to worktree layout if needed
- repo list - List all repositories including newly created ones
Common Use Cases
Start a new project
Create experimental repositories
Organize by category
Quick prototyping
Tips
The
repo new command creates standard Git repositories, not worktree-based ones. To convert an existing repository to worktree layout, use repo convert.Workflow Example
Implementation Details
Source code:functions/new.zsh:1
The command:
- Cleans the repository path using
clean_repo_path - Constructs the full path under
$REPO_BASE_DIR - Creates parent directories with
mkdir -p - Runs
git initunless.gitalready exists - Navigates to the repository via the
post_repo_newhook