Repository & Setup

Basic
git init

Initialize a new Git repository in the current directory

git clone <url>

Clone an existing repository from a remote URL

git clone --depth 1 <url>

Shallow clone (only recent history, saves space)

Basic
git config --global user.name "Your Name"

Set your global username for commits

git config --global user.email "your@email.com"

Set your global email for commits

git config --global core.editor "code --wait"

Set VS Code as your default Git editor

git config --list

List all current Git configurations

Intermediate
git remote add origin <url>

Add a new remote repository

git remote -v

List all remote repositories with URLs

git remote set-url origin <new-url>

Change the URL of a remote repository

git remote show origin

Show detailed information about a remote