11
kamen
3y

"Let me just quickly clean up the old stashes since everything is merged and I won't need them... "

Guess what, I needed that stash, and I had it saved 20 minutes ago.

Comments
  • 2
    Totally happens.
  • 2
    @Root Yup. Good thing is that it wasn't something significant - I rewrote it in like 15 minutes.
  • 2
    Recently switched machines and left about 120 (maybe more) stashes behind. Feels weird.
  • 2
    When using GIT commits as stashes (as git stash does), you can undo deletion until the commit actually gets garbage collected - which is guaranteed to be delayed a few days by default.

    whenever you think, you fucked up your GIT, chances are, that Linus thought about that possibility and prevented it from actually happening. GIT is a masterpiece. You can almost always undo in GIT.
    Trust GIT as GIT is your friend - and ask StackOverflow in case you don't know how to recover.
  • 4
    @Oktokolo If only it had a user interface.
    xkcd 1597:
  • 0
    @Oktokolo Yeah, thought about that, but the first thing I found on StackOverflow returned nothing.
  • 0
    @Fast-Nop
    Well, Linus isn't exactly known for his great user interfaces...

    But the big IDEs come with some GUI for the most-often used GIT commands and gitk is sorta okay for looking at the tree.
    There also are dedicated GUIs for GIT. And even the good ole Tortoise exists for GIT.

    I prefer to keep a gitk open to quickly look at the tree before and after cherrypicking my chaotic WIP commits into nice and clean feature commits. The actual GIT commands i do in the JetBrains IDE i am writing the code in.
    I now only use the command line when i really fucked up, so i need to find commits not linked to a branch anymore (like the OP) or want to rewrite history.

    GIT's user interface isn't great. But for a CVS, it isn't bad either. And switching from Subversion to GIT literally made me love version control where it just was an annoying chore before. And back then i actually switched from Tortoise SVN to GIT on the command line...
  • 0
    @kamen
    This looks like a decent howto:
    https://mobilejazz.com/blog/...

    It is about finding the "dangling commit" created by git stash, which is still there but got removed from the stash list.
    You can then apply the stash by commit ID or even create a new branch from it.
  • 0
    @Oktokolo SVN is perfectly fine for most projects, and its simplicity is a major feature. At work, I am happy with it because all I need to remember is how directories and files work. I can still use it after months because coding is only a sometimes small part of my job scope.

    Where SVN does fail, that's projects like the Linux kernel with 1k devs world-wide, that's why Git was created. It's the complexity of that problem domain that justifies the complexity of the solution, though not the shitty UI.
  • 0
    @Fast-Nop
    SVN works for small projects. But it was only when i started using GIT, that i realized, that SVN really sucks hard.
    Branching, merging and cherrypicking are just so much less hassle in GIT than they where in SVN.

    And GIT doesn't actually need more skill or knowledge if you don't do stuff like history rewriting. Where SVN would have left you fucked for good, you can almost always get your work back with GIT after spending some time on StackOverflow.

    GIT isn't intuitive at first, because it just does everything different than the other version control systems.
    But if you get the independend local trees and read the manual, it is surprisingly easy to git good using it.
Add Comment