# GitHub Cheat Sheet

# Clone

Clone means downloading a repository hosted on GitHub to your local machine.

To clone a repository, first open the repository on GitHub:

repository page

Then click on "Clone or download" and copy the url that showed up:

clone button

# Terminal

After copying the url, use the following command in terminal where https://github.com/tianhaoz95/codeNboba.git should be the url you just copied:

git clone https://github.com/tianhaoz95/codeNboba.git

# Desktop app

Cloning a repository with the GitHub Desktop app is much eaiser with just a simple click on "Open in Desktop":

open in desktop

# Branch

# Create a branch

# Check out a branch

# Desktop app

desktop app check branches

# Terminal

git checkout [awesome_branch_name]


If the branch is newly created with the web or desktop app, do git pull or git fetch first.

# Delete a branch

# Rename a branch

git branch -m [old-name] [new-name]
git push origin :[old-name] [new-name]
git push origin -u [new-name]