Introduction
On this page, you can find a brief description of the git init, git clone, git config, and git alias commands. Also, read their common and basic usages.

Before you can track changes, branch, or collaborate, you need a Git repository — the .git folder where Git stores the complete history of your project. This section walks through the four commands you reach for whenever you start working with a repository:
git init— turn a plain folder into a new, empty repository.git clone— copy an existing repository (usually from a server) onto your machine.git config— set your identity and tune how Git behaves.- Git aliases — create short, memorable names for commands you type often.
Each command gets its own dedicated page; this introduction gives you the mental model and a quick reference so you know which one to use and when. If you have not installed Git yet, start with Install Git.
git init
The git init command turns the current directory into a new, empty Git repository. It creates a hidden .git subdirectory containing everything Git needs to track your project — object storage, the staging area (index), refs, and a default HEAD. Until this directory exists, Git has nothing to track.
Use git init when you are starting from scratch or want to put an existing local project under version control. Nothing in your working files is changed or committed automatically — init only sets up the plumbing.
# Start a brand-new project in the current folder
git init
# Or create the folder and initialize it in one step
git init my-projectRunning it on an already-initialized folder is harmless: Git reports Reinitialized existing Git repository and leaves your history intact.
git clone
The git clone command makes a local copy of an existing repository, including its full commit history, and wires it up to talk to the original. It is how most contributors get a project: you clone once, then pull and push from then on.
Cloning automatically sets the source as a remote named origin, checks out the default branch, and creates remote-tracking branches so Git knows what the server's branches look like.
# Clone into a folder named after the repo
git clone https://github.com/user/project.git
# Clone into a custom folder name
git clone https://github.com/user/project.git my-folderReach for clone instead of init whenever the project already lives somewhere else — you almost never git init a repo that already exists on a server.
git config
The git config command reads and writes Git's configuration variables, which control everything from your commit identity to default behavior and colors. Configuration lives at three levels, each overriding the one above it:
--system— applies to every user on the machine.--global— applies to the current user (stored in~/.gitconfig).--local— applies only to the current repository (the default if no level is given).
The first thing every new Git user must do is set their name and email, since these are stamped onto every commit:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"To read a value back or list everything, use:
# Read one setting
git config --global user.name
# List all effective settings and where each came from
git config --list --show-origingit alias
A Git alias is a shortcut that maps a short name to a longer command. There is no standalone git alias command — aliases are just configuration entries created with git config (or by editing ~/.gitconfig directly). Set them once and they save keystrokes forever.
# Now "git co" runs "git checkout"
git config --global alias.co checkout
# A richer alias: a compact, graphical log
git config --global alias.lg "log --oneline --graph --all"After defining the aliases above, git co main behaves exactly like git checkout main, and git lg prints a condensed history graph. See git alias for advanced aliases, including shell-command aliases.
Putting it together
A typical first-time setup looks like this — configure your identity once, then either start a new repo or clone an existing one:
# 1. One-time identity setup (do this once per machine)
git config --global user.name "Ada Lovelace"
git config --global user.email "[email protected]"
# 2a. Start a new project...
git init my-app
# 2b. ...or grab an existing one
git clone https://github.com/user/my-app.gitFrom here you are ready to stage changes with git add and record them with git commit.