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

    Branches and merging · Lesson 8 of 15

    Park work temporarily with stash

    Clean the working tree without a fake commit, then restore work.

    9 minutes2 games

    If an urgent bug arrives mid-feature, git stash push stores tracked and staged changes on a temporary stack and cleans the tree. Return with git stash pop.

    Unfinished work

    stash push

    Urgent task

    stash pop

    Git
    git init -q -b main
    echo "v1" > app.txt
    git add app.txt
    git commit -q -m "Base"
    echo "draft" >> app.txt
    git stash push -m "feature draft"
    git stash list

    pop applies the latest stash and removes it on success; apply keeps it. Add a clear message. In real Git, untracked files require -u.

    Important

    A stash is local and temporary, not a backup and not pushed. Important or long-lived work belongs on a branch with commits.

    Quick question

    Apply a stash but keep it listed?

    Interview question

    Stash or a WIP commit?

    Exercise

    Commit clean, change it to draft, stash it, then print the file.

    Expected output: clean

    Git
    git init -q -b main
    echo "clean" > app.txt
    git add app.txt
    git commit -q -m "Base"
    echo "draft" > app.txt
    cat app.txt

    Learn more from

    • Git: git-stashgit-scm.com
    • Atlassian: Git stashatlassian.com

    Played 0 of 2 games

    Sign in to save your progress and earn XP.

    PreviousResolve merge conflictsNextRestore and unstage
    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.