Creates a new Git repository.
Option | Description |
---|---|
--bare | Creates a bare repository without a working directory |
--template=<template-directory> | Uses templates from the specified template directory |
Examples:
git init
- Creates a new Git repository in the current directorygit init my_project
- Creates a new Git repository in the specified directorygit init --bare remote_repo.git
- Creates a bare repository (for server use)
Copies an existing repository to your local machine.
Option | Description |
---|---|
--branch, -b <branch-name> | Checks out the specified branch |
--depth <depth> | Creates a shallow clone with the specified depth |
--recursive | Recursively clones submodules |
Examples:
git clone https://github.com/username/repository.git
- Clones a remote repositorygit clone https://github.com/username/repository.git my_folder
- Clones to a specified foldergit clone --branch develop https://github.com/username/repository.git
- Clones a specific branchgit clone --depth 1 https://github.com/username/repository.git
- Clones only the latest commit (no history)