Quantcast
Browsing all 52 articles
Browse latest View live

Answer by Greg Hewgill for How to recover a dropped stash in Git?

I just constructed a command that helped me find my lost stash commit:for ref in `find .git/objects | sed -e 's#.git/objects/##' | grep / | tr -d /`; do if [ `git cat-file -t $ref` = "commit" ]; then...

View Article


Answer by Nathan Jones for How to recover a dropped stash in Git?

git fsck --unreachable | grep commit should show the sha1, although the list it returns might be quite large. git show <sha1> will show if it is the commit you want.git cherry-pick -m 1...

View Article


How to recover a dropped stash in Git?

I frequently use git stash and git stash pop to save and restore changes in my working tree. Yesterday I had some changes in my working tree that I had stashed and popped, and then I made more changes...

View Article

Answer by anapsix for How to recover a dropped stash in Git?

Knowing the approximate file name and it's location, and was able to find dropped stash files grepping dangling commits for pathfor i in $(git fsck --no-reflogs | awk '/dangling commit/ {print $3}');...

View Article

Image may be NSFW.
Clik here to view.

Answer by minTwin for How to recover a dropped stash in Git?

This worked for me (in 2022) with recovering my accidently deleted stash in git from a windows environment.These steps outline how to recover any deleted git stashes or branches (assuming it has not...

View Article


Answer by anapsix for How do I recover a dropped stash in Git?

Knowing the approximate file name and it's location, and was able to find dropped stash files grepping dangling commits for pathfor i in $(git fsck --no-reflogs | awk '/dangling commit/ {print $3}');...

View Article

Image may be NSFW.
Clik here to view.

Answer by minTwin for How do I recover a dropped stash in Git?

This worked for me (in 2022) with recovering my accidently deleted stash in git from a windows environment.These steps outline how to recover any deleted git stashes or branches (assuming it has not...

View Article

Answer by Lovekush Vishwakarma for How do I recover a dropped stash in Git?

You can follow the below process step by step:1- use below to list all unreachable commitsgit fsck --unreachable2- to show unreachable commit hash bygit show hash3- copy all log, you can see log like,...

View Article


Answer by Treviño for How do I recover a dropped stash in Git?

To see the commits in terminal, only filtering the ones we care about we can use:git log --oneline --all --grep="^WIP on .*: [a-f0-9]\+" --grep="^On [^ ]*:" --grep="^index on [^ ]*:" $( env LANG=C git...

View Article


Answer by Abhi for How do I recover a dropped stash in Git?

You can achieve this in 2 easy stepsList lost stashes--> run this command for a project where all stashes were trashed:git fsck --unreachable | grep commit | cut -d '' -f3 | xargs git log--merges...

View Article

Answer by Adrian W for How do I recover a dropped stash in Git?

My favorite is this one-liner:git log --oneline $( git fsck --no-reflogs | awk '/dangling commit/ {print $3}' )This is basically the same idea as this answer but much shorter. Of course, you can still...

View Article

Answer by Vivek Kumar for How do I recover a dropped stash in Git?

You can list all unreachable commits by writing this command in terminal - git fsck --unreachableCheck unreachable commit hash - git show hashFinally apply if you find the stashed item - git stash...

View Article

Answer by Koen for How do I recover a dropped stash in Git?

I couldn't get any of the answers to work on Windows in a simple command window (Windows 7 in my case). awk, grep and Select-string weren't recognized as commands. So I tried a different approach:first...

View Article


Answer by Can Tecim for How do I recover a dropped stash in Git?

In OSX with git v2.6.4, I just run git stash drop accidentally, then I found it by going trough below stepsIf you know name of the stash then use: $ git fsck --unreachable | grep commit | cut -c 20- |...

View Article

Answer by RobbyD for How do I recover a dropped stash in Git?

Why do people ask this question? Because they don't yet know about or understand the reflog.Most answers to this question give long commands with options almost nobody will remember. So people come...

View Article


Answer by Brad Feehan for How do I recover a dropped stash in Git?

The accepted answer by Aristotle will show all reachable commits, including non-stash-like commits. To filter out the noise:git fsck --no-reflog | \awk '/dangling commit/ {print $3}' | \xargs git log...

View Article

Answer by emragins for How do I recover a dropped stash in Git?

Windows PowerShell equivalent using gitk:gitk --all $(git fsck --no-reflog | Select-String "(dangling commit )(.*)" | %{ $_.Line.Split('')[2] })There is probably a more efficient way to do this in one...

View Article


Answer by Abhijeet for How do I recover a dropped stash in Git?

Recovered it by using following steps:Identify the deleted stash hash code: gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )Cherry Pick the Stash:git cherry-pick -m 1...

View Article

Answer by Ben for How do I recover a dropped stash in Git?

What I came here looking for is how to actually get the stash back, regardless of what I have checked out. In particular, I had stashed something, then checked out an older version, then poped it, but...

View Article

Answer by Shaheen Ghiassy for How do I recover a dropped stash in Git?

I liked Aristotle's approach, but didn't like using GITK... as I'm used to using GIT from the command line. Instead, I took the dangling commits and output the code to a DIFF file for review in my code...

View Article
Browsing all 52 articles
Browse latest View live