Want to Learn Git and GitHub? A Step-by-Step Guide to Version Control

Published: (January 18, 2026 at 08:09 AM EST)
3 min read
Source: Dev.to

Source: Dev.to

Introduction

If you’re like many beginners, you’ve probably heard terms like “pushing to main” or “merging branches” and wondered what they mean. This guide walks you through the fundamentals of Git and GitHub, showing how to install them, configure them, and use them to manage your code effectively.

What is Git?

Git is a version control system—a smart history book for your code. Every time you make changes, Git records them, allowing you to:

  • Track modifications – see what changed, when, and by whom.
  • Revert – go back to an earlier state if something goes wrong.

What is GitHub?

GitHub is a web‑based hosting service for Git repositories (think of it as the cloud for your code). It lets you:

  • Store – keep a backup of your projects.
  • Share – make your code accessible to others.
  • Collaborate – provide a central hub for teamwork without overwriting each other’s work.
  • Showcase – build a portfolio of your projects.

Installing Git Bash (Windows)

  1. Download Git Bash from the official site.

  2. Run the installer and follow the on‑screen instructions. The default options work for most users.

    • Choosing the default editor: keep the default (Vim) or select another editor you prefer (VS Code, Notepad++, etc.).
    • Adjusting the name of the initial branch: choose “Let Git decide” (it now defaults to main).
  3. Verify the installation: open Git Bash and run

    git --version

    You should see the Git version number.

Configuring Git

Before using Git, set your identity:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

Verify the settings:

git config --global --list

Setting Up a GitHub Account and SSH Key

  1. Create a GitHub account.

  2. Generate an SSH key (so you won’t be prompted for a password each time):

    ssh-keygen -t ed25519 -C "your@email.com"

    Press Enter through the prompts to accept defaults.

  3. Start the SSH agent:

    eval "$(ssh-agent -s)"
  4. Add the SSH key to the agent:

    ssh-add ~/.ssh/id_ed25519
  5. Copy the public key:

    cat ~/.ssh/id_ed25519.pub

    Copy the displayed string.

  6. Add the key to GitHub:

    • Go to Settings → SSH and GPG keysNew SSH key.
    • Paste the copied key and save.

Initializing a Local Repository

Assume you have a folder named my-cool-app.

cd path/to/my-cool-app
git init

Create a simple file, e.g., readme.txt, with the content “Hello world”.

Add and Commit

git add .
git commit -m "My first save point"

Creating a Remote Repository on GitHub

  1. On GitHub, click New repository and give it a name.
  2. Copy the SSH URL that looks like git@github.com:yourname/your-repo.git.
git remote add origin git@github.com:yourname/your-repo.git

Push to GitHub

git push -u origin main

Refresh the GitHub page—you should see your code online.

Pulling Changes

If you work on another computer or a collaborator updates the repository, bring those changes to your local copy:

git pull origin main

The “Big Three” Commands

ActionCommandPurpose
Addgit add <file>Stage changes you want to record
Commitgit commit -m "message"Save a snapshot of staged changes
Pushgit pushSend commits to the remote repository

Don’t worry if you forget commands at first—searching for them is part of the learning process. Keep practicing, and it will soon feel natural.

Happy coding! 🥳

Back to Blog

Related posts

Read more »

Introduction to Gitbash and Github

Definitions - Git is a widely used, free, and open‑source system designed to handle projects of all sizes. It enables developers to track changes in code and f...