Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    GITGit & GitHub

    Basics: from file to commit

    • Why version control?
    • From working tree to commit
    • Read history and differences
    • .gitignore and useful commit messages

    Branches and merging

    • Branches and HEAD
    • Merge: fast-forward and three-way
    • Resolve merge conflicts
    • Park work temporarily with stash

    Undo without losing work

    • Restore and unstage
    • Reset: soft, mixed and hard
    • Revert or reset?
    • Amend and reflog: rescue recent work

    Remotes and GitHub Flow

    • Remotes, push and tracking
    • Fetch, pull and rejected pushes
    • GitHub Flow: complete project
    Git & GitHub

    Basics: from file to commit · Lesson 1 of 15

    Why version control?

    What Git solves, and how it differs from GitHub and random backup copies.

    8 minutes2 games

    If your files are named final.js, final-2.js and final-really.js, you are doing version control by hand. Git records connected snapshots of a project: what changed, by whom, and why. You can test an idea, return to a known-good state, or combine a team's work without emailing ZIP files.

    Git is a local program; GitHub hosts repositories and adds pull requests, reviews and team tools. Git works without GitHub.

    Project files

    Git records snapshots

    Remote for sharing

    GitHub: reviews and PRs

    Git
    git init -q -b main
    echo "SeaCode" > README.md
    git status -s

    git init creates a repository in a hidden .git directory; your files do not move. status -s says ?? README.md: the file exists but Git is not tracking it yet. Git is distributed: every clone carries the full history, not only the latest files.

    Important

    Git is not magical backup: local commits can disappear with the machine. Push to a trusted remote, but never commit secrets or .env files; published Git history is difficult to clean.

    Quick question

    Which statement is correct?

    Interview question

    What is the difference between Git and GitHub?

    Exercise

    Start a repository on main, create README.md containing Hello Git, and print short status.

    Expected output: ?? README.md

    Git
    echo "Hello Git" > README.md
    git status -s

    Learn more from

    • Git: gittutorialgit-scm.com
    • GitHub Docs: About Gitdocs.github.com

    Played 0 of 2 games

    Sign in to save your progress and earn XP.

    NextFrom working tree to commit
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.