The Ultimate Manual: Understanding Git and GitHub without Headche.

Published: (January 17, 2026 at 12:27 AM EST)
4 min read
Source: Dev.to

Source: Dev.to

Cover image for The Ultimate Manual: Understanding Git and GitHub without Headache

The concept: Git vs. GitHub

Git vs. GitHub diagram

Imagine you are working on a major project. You spend many hours writing code, only to discover that the “fix” you implemented ten minutes ago broke everything. You keep hitting the redo button, but it’s not enough—your work is gone.

That’s where Version Control comes in. This article helps beginner developers bridge the gap between Git (the local tool) and GitHub (the cloud platform).

What’s the difference?

  • Git – a local version‑control system that lives on your computer and tracks changes in files.
  • GitHub – a cloud platform that hosts Git repositories online, making collaboration easy.

Advantages of using Git + GitHub

  • Safety
  • Traceability and accountability
  • High‑confidence experimentation
  • Collaboration
  • Off‑site backup

Setting Up the Environment (Git Bash)

  1. Install Git – follow the instructions at the official site: .

  2. Configure your identity – this lets Git know who is making the changes.

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

Setting Up the Environment (GitHub)

  1. Create a GitHub account and sign in: .

  2. Generate an SSH key (password‑less, secure connection).

    ssh-keygen -t ed25519 -C "youremail@example.com"

    When prompted for “Enter a file to save the key”, just press Enter to accept the default location.

  3. Check for an existing SSH key (optional):

    cat ~/.ssh/id_ed25519.pub

Adding a Public Key to Your GitHub Account

  1. Copy the public key

    cat ~/.ssh/id_ed25519.pub
  2. Add the key on GitHub

    • Go to Settings → SSH and GPG keys → New SSH key.
    • Give the key a descriptive title.
    • Paste the copied public key into the Key field.
    • Click Add key.
  3. Test the connection

    ssh -T git@github.com

    You should see a message confirming successful authentication.

The Push and Pull Commands

Push & Pull workflow

Git does not automatically save everything; you must be intentional—think of it like taking a photograph.

  1. Working directory (the set) – the files you are currently editing.

  2. Staging area (the pose) – the changes you are ready to save. Add them with:

    git add          # specify files
    # or to add everything:
    git add .
  3. Repository (the photo) – commit the staged changes:

    git commit -m "Your descriptive commit message"
  4. Push – send your local commits to the remote repository on GitHub:

    git push origin main   # replace 'main' with your branch name if different
  5. Pull – fetch and merge changes from the remote repository:

    git pull origin main

Recap

To master Git, understand the journey your code takes:

  1. Edit in the working directory.
  2. Stage the desired changes.
  3. Commit to create a permanent snapshot.
  4. Push to share your work on GitHub.
  5. Pull to incorporate others’ contributions.

With these fundamentals, you’re ready to collaborate confidently and keep your code safe. Happy coding!

# Git Basics Cheat‑Sheet

## The Three Areas of Git

- **Working Directory** – the files you are editing.  
- **Staging Area** – files you have marked to be saved.  
- **Repository** – the permanent history of your project.

---

## Pushing Code to GitHub

*Pushing* is the act of uploading local commits to a remote server.  
It makes your code accessible to others and serves as a backup.

```bash
git push origin main

Pulling Code from GitHub

Pulling downloads the latest changes that others have uploaded, keeping your local copy in sync with the master copy online.

git pull

Quick Reference Flow

ActionCommandDescription
Add changes to the indexgit add <file>Stage files for the next commit
Record a snapshotgit commit -m "msg"Save staged changes to local history
Send local commits upstreamgit pushUpload local history to GitHub
Get remote changesgit pullDownload and merge remote changes

Visual Overview

Git workflow diagram


The “Big Five” Git Commands and Real‑World Analogies

CommandActionReal‑World Analogy
git initInitializes a new repositorySetting up a new filing cabinet
git addStages your changesPutting a letter in an envelope
git commit -m "msg"Records the staged changesDropping the letter in the mailbox
git pullFetches changes from GitHubChecking your mail for updates
git pushSends local commits to GitHubDelivering the letter to the post office

Your First Repository

  1. Open a terminal and navigate to your project folder.

  2. Initialize a new repository:

    git init
  3. After writing some code, follow the “Save Ritual”:

    git add .
    git commit -m "Initial commit"
    git push origin main   # after you have created a remote on GitHub

Saving code on your laptop is good, but pushing it to GitHub provides:

  • Protection against hardware failure.
  • A showcase for your work that you can share with others.

Conclusion

Learning Git and GitHub can feel like learning a new language on top of your programming language, but it’s an essential skill for any developer. By mastering the cycle of tracking → committing → pushing → pulling, you’re not just saving files—you’re building a professional portfolio and a safety net that gives you confidence to experiment.

Don’t panic if you need to look up commands (even the pros do). Practice makes perfect; the more you use these commands, the more they become second nature.

My advice: go ahead—create a repository, make a mess, and use this “Head‑ache‑Free Manual.”


What was the first thing you ever “pushed” to GitHub? Let me know in the comments!

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...