Sitemap
Bhathrayinisenthilkumar

Bhathrayinisenthilkumar

Git and GitHub Tutorial for Beginners

4 min readAug 21, 2026

--

Git is a tool that helps us keep track of changes in our projects. It is very useful when we are working on code.

GitHub is a website where we can store our Git projects online and share them with other people.

Git and GitHub are not the same. Git works on our computer, while GitHub allows us to store and work with our Git projects online.

Installing Git

First, install Git on your computer.

After installing it, open the terminal and check the installation:

git — version

If Git is installed correctly, you will see the Git version.

Setting Up Git

Before using Git, we should set our name and email:

git config — global user.name “Your Name”

git config — global user.email “you@example.com”

We can check the settings with:

git config — global — list

Creating a Git Project

Press enter or click to view image in full size
GitHub projects

Creating a Git Project

Let’s create a small project.

Open the terminal and type:

mkdir my-website

cd my-website

git init

Press enter or click to view image in full size
Git init

The git init command creates a new Git repository.

Adding a File

Create a file called index.html and add some HTML to it.

Then check the project:

git status

Now add the file to Git:

git add index.html

Then create a commit:

git commit -m “Create homepage”

A commit saves a version of our project.

Making Changes

If we change our index.html file, we can check the changes:

git status

We can also see exactly what changed:

git diff

Then add and commit the changes:

git add .

git commit -m “Update homepage”

The basic Git process is:

Make changes → git add → git commit

Branches

A branch allows us to work on a new feature without changing the main project directly.

For example:

git switch -c login-page

Now we can create our login page and commit the changes:

Get Bhathrayinisenthilkumar’s stories in your inbox

Join Medium for free to get updates from this writer.

git add .

git commit -m “Add login page”

Press enter or click to view image in full size
Git commit

When the feature is ready, go back to the main branch:

git switch main

Then merge the changes:

git merge login-page

Press enter or click to view image in full size
Git merge

GitHub

Now we can upload our project to GitHub.

Create a new repository on GitHub. Then connect our local project to it:

git remote add origin <repository-address>

Then upload the project:

git push -u origin main

Git push

Our project is now on GitHub.

Git Pull and Clone

If someone changes the project on GitHub, we can get the latest changes with:

git pull

Git pull

If we want to download an existing GitHub project, we can use:

git clone <repository-address>

Pull Requests

When working with other developers, we can create a separate branch, make our changes, and push the branch to GitHub.

Then we can create a Pull Request.

A Pull Request allows other developers to review our changes before they are merged into the main project.

Useful Git Commands

  • git init — Creates a Git repository.
  • git status — Shows the current status of the project.
  • git add . — Adds changes to the staging area.
  • git commit -m “message” — Saves the changes.
  • git push — Uploads changes to GitHub.
  • git pull — Gets the latest changes from GitHub.
  • git clone <repository-address> — Downloads a GitHub repository.
  • git switch -c feature-name — Creates a new branch.
  • git merge feature-name — Merges a branch.

Conclusion

Git helps us track changes in our projects, and GitHub helps us store and share those projects online.

The basic workflow is:

Write code → git add → git commit → git push

Once we practice these commands, Git and GitHub become much easier to understand.

--

--