• Let me again plug Fork, a really great Git client for macOS and Windows.It’s not open source, and it’s not free ($50), but it’s worth every penny. It makes stashes very easy and intuitive — they even show up in the history view, as though they were a 1-commit branch.


    score 0 · canonical

  • lobsters__bjg@crustaceanson.theshelf.topM
    link
    fedilink
    arrow-up
    1
    ·
    15 days ago

    My favorite thing I learned about git stash recently is that you can just go edit the stash ref list file if you want to give your stashes better names. Just open up .git\logs\ref\stash in your favorite editor and rename the stashes as you see fit.

    It looks something like:

    0000000000000000000000000000000000000000 b77a4fd5c052a9ec212780eca4952540ad882bcb Author <author@example.com> 1563653910 -0700     My Special Stash Message just for lobste.rs
    b77a4fd5c052a9ec212780eca4952540ad882bcb 36ab6d95465bcce60636aa398cdf95350f5fc688 Author <author@example.com> 1564602521 -0700     Example of another stash message that I edited just for lobste.rs
    

    Also, if your list of stashes ever grows to a large amount, you can use tig to browse the stash list with tig stash. In that view by default maps the ! key to drop the stash. This lets you easily browse through the list of stashes, seeing what’s in them, and dropping all the stuff you don’t care about.


    score 2 · canonical

  • Imagine coming into a thread and reading about people using stash properly while I use it as a sweat-free git reset when I did a tiny modification and there is a merge conflict. Oh well, this might be the day that I learn :D


    score 1 · canonical

  • lobsters__loc@crustaceanson.theshelf.topM
    link
    fedilink
    arrow-up
    1
    ·
    15 days ago

    Nice write up. While show was mentioned, I feel this is missing git stash show stash@{3} -p to review the changes a patch contains. I’ve also used this to resolve conflicts by dumping the patch to a file that I can easily modify before applying.

    $ git stash show stash@{3} -p > tmp.patch
    $ vim tmp.patch
    $ git apply tmp.patch
    

    score 1 · canonical