Initialize a new Git repo
Use git init to create a new Git repository in a folder. This is a one-time command — you only run it once when setting up a new project.
Initialize the repository
To initialize in an existing directory:
After running git init, Git creates a hidden .git/ folder inside your project to track all changes.
Clone an existing repo
If your project already exists on a remote server (GitHub, Bitbucket, etc.), clone it to your local machine. Like git init, this is also a one-time command.
git clone <repo_url>
# Example
git clone https://github.com/KarChunT/karchunt.com
Clone to a specific folder
git clone <repo_url> <directory>
# Example
git clone https://github.com/KarChunT/karchunt.com karchunt
Clone a specific branch
git clone --branch <branch> <repo_url>
# Example
git clone --branch development https://github.com/KarChunT/karchunt.com
Use git clone --branch to start from a specific branch directly, instead of cloning the default branch and switching afterwards.