# Git and GitHub Fundamentals

Here is the module

%[https://www.figma.com/slides/XVwVfKxfGkY6Bb37Tjkg2r/GIT-AND-GITHUB--FUNDAMENTALS?node-id=1-26&t=Ing4Nx0eMMlCZhkz-1] 

# What is Git?

Git is a tool that helps you track changes in your code. It allows you to save different versions of your work and go back to them if needed.

# **What is GitHub?**

GitHub is a website where you can store your Git projects online. It lets you share your code with others, collaborate with teammates, and manage your projects in one place.

# Why do we need to use git and Github?

### Version Control:

Git helps you track and manage changes to your code, so you can go back to previous versions if something goes wrong.

### Collaboration:

GitHub allows multiple people to work on the same project at the same time without overwriting each other's work.

### Backup and Sharing:

GitHub stores your code online, providing a backup and making it easy to share your projects with others or showcase your work

to get started

# Check Git Version

```bash
git --version
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679077314/114e20b1-7bf3-4ae3-94ed-7c4b656dbfd8.png align="center")

# Configuration

```bash
git config --global user.name "thirdygayares"
git config --global user.email "gayaresthird@gmail.com"
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679094530/eb875e59-0e2b-452c-8b7b-c38ae31632f2.png align="center")

# Create a folder and type cmd on a search bar

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679112298/58ac7c71-cc76-4a6c-b954-83dd4aced550.png align="center")

# Git initialization

```bash
git init
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679155973/a289ce52-0cb2-43d3-995b-fda1940e269a.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679163153/f3fa55e3-4915-4b86-9de8-c42a88276971.png align="center")

# Git Add

```bash
git add .
```

# Git Status

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679228490/89cd7399-a99f-405d-8daf-49abd6ccf00f.png align="center")

# Git Commit

```bash
git commit
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679258073/100b7556-70cb-4a4c-91cc-f9188a138fc9.png align="center")

# Git Log

```bash
git log
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679290174/6701a98b-d726-4cc0-942f-a30eb1a85ab6.png align="center")

to push your code on GitHub follow these steps

# SET UP GITHUB

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679312491/656e5ec5-2b97-4847-9e75-131bcc87e2a4.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679321860/e8433b22-6d5e-4b45-90f9-55d9bbff8f89.png align="center")

# CREATE BRANCH

```bash
git brance -M main
```

# ADD REMOTE

```bash
git remote add origin https://github.com/thirdygayares/Github_Push_Example.git
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679409983/9dcd74bf-9b1a-4160-8f43-b7fe4f7eeda7.png align="center")

# Git Push

```bash
git push -u origin main
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679445754/5852ec66-af42-48e3-bd54-ed45e8542796.png align="center")

# Git Pull

```bash
git pull origin main
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679484414/9bad2d94-bdf1-4997-9dc0-e9262a142e13.png align="center")

Check Github Commits

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679552162/e944d51e-a69f-48ea-b8ad-d4fb7d098f9c.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724679559382/7a98d7b8-b561-4a32-9749-a991a49f2575.png align="center")
