# Git Basics

{% hint style="info" %}
**NOTE: Do not include angle brackets `< >`**
{% endhint %}

For more information, check out the [Git Documentation](https://git-scm.com/docs)

### **Sharing and Updating Repositories**

#### Git Pull

```bash
git pull <options> <repository>
```

Pulls changes from a remote repository into the current branch. If the current branch is behind the remote, then by default it will fast-forward the current branch to match the remote.

#### Git Status

```bash
git status
```

Displays paths that have changes between your local repository and the HEAD of the remote repository

#### Git Add

```bash
git add <changes to be staged>
```

This command updates the index using the current content found in the working tree, to prepare the content staged for the next commit. To stage all changes, use `git add .`

#### Git Commit

```bash
git commit -m <"Commit Title">
```

Create a new commit containing the current contents of the index and the given log message describing the changes.

#### Git Push

```bash
git push origin main
```

Updates the main branch of the remote repository based on the last local commit

### Branching and Merging

#### Git Branch:

```bash
git branch
```

Lists all existing branches; the current branch will be highlighted in green and marked with an asterisk

#### Git Checkout:

```bash
git checkout -b <"new branch name">

or

git checkout <existing branch name>
```
