Git Topics (9)Tap to view
    Git·Version Control·Topic 8 of 9

    Git Stashing & Tags

    Caching unfinished work (stash), creating and managing version tags (tags), and digital signature.

    1. Stashing Commands

    1. git stash

      What it doesCauses unprocessed changes in memory and returns a clean Working Tree

      When to use itWhen you need to move to another branch sooner before completing the commit

      Examplegit stash

    2. git stash save "work in progress"

      What it doesSave changes with an explanatory message for easy remembering later

      When to use itWhen there are multiple stashes and you want to distinguish each one

      Examplegit stash save "refactor auth logic"

    3. git stash list

      What it doesDisplays a list of all cached edits and their handles

      When to use itTo review what you stored previously

      Examplegit stash list

    4. git stash pop

      What it doesRetrieves the last saved stash and applies it to the branch and deletes it from the list

      When to use itWhen you return to your branch and wish to resume your previous work

      Examplegit stash pop

    5. git stash apply

      What it doesApplies the last stash to files while keeping a copy of it in the list without deleting it

      When to use itTo apply the same modifications to more than one branch of the experiment

      Examplegit stash apply

    6. git stash drop stash@{0}

      What it doesManually deletes a selected stash from the list without applying it

      When to use itto get rid of demo work you no longer need

      Examplegit stash drop stash@{0}


    2. Tags and Releases

    1. git tag v1.0.0

      What it doesCreates a Lightweight Tag at the current HEAD location

      When to use itto reference an internally defined version flag

      Examplegit tag v1.0.0

    2. git tag -a v1.0.0 -m "Release version 1.0.0"

      What it doesCreates an Annotated Tag that includes a message, name and date of the owner of the tag

      When to use itFor official production releases

      Examplegit tag -a v1.0.0 -m "Release v1.0.0"

    3. git tag -s v1.2.0 -m "Signed release"

      What it doesCreates a cryptographically signed tag using a GPG key to ensure identity

      When to use itin high security open source and production projects

      Examplegit tag -s v1.2.0 -m "Signed release"

    4. git tag --list

      What it doesdisplays all tags saved in the repository

      When to use itto search for previous versions

      Examplegit tag --list "v1.*"

    5. git push origin v1.0.0

      What it doesUploads a specific tag to the remote repository

      When to use itto publish a new version tag to GitHub

      Examplegit push origin v1.0.0

    6. git push origin --tags

      What it doesuploads all new local tags to the remote repository at once

      When to use itWhen you have created multiple tags and want to publish them all

      Examplegit push origin --tags

    Offline · Reading cached copy