Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6118307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:25:16+00:00 2026-05-23T15:25:16+00:00

If I create a commit with git stash create whatever I get a hash

  • 0

If I create a commit with git stash create whatever I get a hash of the commit back, but I can’t find that commit hash with git reflog.

git log stash doesn’t work either, not does git stash list.

How can I list the commits I create using git stash create?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:25:17+00:00Added an answer on May 23, 2026 at 3:25 pm

    If you use the script in this answer, you can then do git stash list.

    #!/bin/sh
    #
    # git-stash-push
    # Push working tree onto the stash without modifying working tree.
    # First argument (optional) is the stash message.
    if [ -n "$1" ]; then
            git update-ref -m "$1" refs/stash "$(git stash create \"$1\")"
    else
            HASH=`git stash create`
            MESSAGE=`git --no-pager log -1 --pretty="tformat:%-s" "$HASH"`
            git update-ref -m "$MESSAGE" refs/stash "$HASH"
    fi
    

    Then you may actually want to get that commit back at some point. To do this, you can list the stashes using git stash list which gives you something like this (remember, these can be dumb commit messages):

    stash@{0}: WTF? Nothing is working
    stash@{1}: it's all working perfectlY!
    stash@{2}: blah2
    

    Then you can restore, say, blah2 by running:

     git stash pop stash@{2}
    

    or as @Eliot points out, you can use this to not destroy your stash:

     git stash apply stash@{2}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I lookup the latest git commit hash from an ant build script?
I get the following error: ActiveRecord::AssociationTypeMismatch in ContractsController#create ExchangeRate(#2183081860) expected, got HashWithIndifferentAccess(#2159586480) Params: {commit=>Create,
I have been wanting to use a git command that saves a stash without
In git, is it possible to create a stash, push the stash to a
In my project master branch I commit changes: git commit -a create & switch
I am trying to display the last commit within Git, but I need the
Currently, when I run git svn dcommit git creates a separate commit in SVN
I used to go back and edit my Mercurial commits to try to create
I am discovering how to use git. I just made the following test: create
On one machine (IP address 192.168.1.2), I create a Git repository by $ cd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.