Git Made Simple

Published: (January 16, 2026 at 05:40 AM EST)
3 min read
Source: Dev.to

Source: Dev.to

Cover image for Git Made Simple

Fariq

It is normal for developers to save different versions of their work, track changes, make updates, and collaborate; this is the work of Git.

What is Git?

Git is a version control system that lets you:

  • Track changes
  • Go to earlier code versions
  • Collaborate
  • Save code online on GitHub

Steps

Step 1: Installing Git Bash

  1. Go to the Git Bash download page.
  2. Select your operating system (Windows, macOS, or Linux).

Git Bash website screenshot

  1. Install Git Bash.
  2. Open Git Bash – you’ll see a terminal that looks like this:
username@computer MINGW64 ~

Step 2: Create (or Log Into) a GitHub Account

  • Go to GitHub.
  • Create an account or log in if you already have one.

Step 3: Connect Git Bash to GitHub

Set up your name

git config --global user.name "Your Name"

Set up your email

git config --global user.email "youremail@example.com"

Note: Make sure the email matches the one on your GitHub account.

Check your configuration

git config --list

Step 4: Create a New Project or Repository

Create a folder

mkdir my-first-git-project

Navigate to the folder

cd my-first-git-project

Git Bash terminal showing the folder

Initialize Git

git init

Now Git is watching this project.

Git Bash showing the repository initialized

Step 5: Track Changes with Git

Create a file

touch index.html

Open the folder directly from Git Bash

code .

The command opens VS Code; the dot (.) means “the current folder”.

Step 6: Create the First Code in VS Code

Open index.html and add the following HTML:

<!DOCTYPE html>
<html>
  <head>
    <title>My First Git Project</title>
  </head>
  <body>
    <h2>Hello World!</h2>
  </body>
</html>

VS Code screenshot of the HTML file

Step 7: Check Git Status in Git Bash

Return to Git Bash and run:

git status

Git will show index.html as untracked, meaning Git sees the file but isn’t tracking it yet.

Git Bash showing untracked file

Step 8: Add the File to Git Tracking

Track index.html:

git add index.html

Or add everything:

git add .

Step 9: Commit Your Changes

git commit -m "Initial HTML file commit"

The -m flag adds a commit message.

Step 10: Create a Repository on GitHub (Online)

Now that your project exists locally, create an online repository on GitHub.

  1. Make sure you’re logged in to GitHub.
  2. Click the + icon in the top‑right corner and select New repository.
  3. Enter a Repository name (use the same name as your folder, e.g., my-first-git-project).
  4. Choose Public (or Private, if you prefer).
  5. Scroll down and click Create repository.

GitHub will now display a set of commands to push your local repository to the remote one.

GitHub new repository screen

From here you can follow the displayed instructions (e.g., git remote add origin …, git push -u origin master) to push your local commits to GitHub.

Step 11: Connect Your Local Project to GitHub

Return to Git Bash and run:

git remote add origin https://github.com/YOUR-USERNAME/my-first-git-project.git

Replace YOUR-USERNAME with your actual GitHub username.

Step 12: Rename the Default Branch

git branch -M main

Step 13: Push Your Code to GitHub

git push -u origin main

Note

  • git push – send your code online
  • origin – the GitHub repository
  • main – the branch name
  • -u – remembers this destination for future pushes

GitHub website

Step 14: Verify on GitHub

Go back to your GitHub repository page and refresh. You should now see the index.html file and the commit message.

Step 15: Pull Code from GitHub

To download the latest code back to your local machine, run:

git pull origin main

GitHub pull illustration

Summarized Git Workflow

Git Workflow

Back to Blog

Related posts

Read more »

WEEK 1 ASSIGNMENT.

Git Git is a version control system used for code collaboration, tracking code changes and who made them. Common Git commands bash git --version Checks whether...