Skip to content

Feature request: Stashing changes when switching branches or "magic stashing" #1633

Closed

Description

@lameyer

Continuation of #245, where it was decided to not automatically stash changes when switching branches for now.

I find "magic stashing" to be one of the most useful features of the previous desktop app. It enables you to think less about managing git, especially when switching between multiple feature branches. It also makes getting started with git easier and more approachable for a new user.

The option to stash when switching branches would be a good alternative, if "magic stashing" confuses users. I often make changes while testing or debugging that I don't want to commit but that I want to keep when switching to another feature branch. Having to go to the command line for stashing is inconvenient and lowers the usefulness of the Desktop app.

Activity

  1. niik commented on May 19, 2017

    @niik
    Member

    Thanks for opening this @lameyer. I'll just note for anyone coming here that a fairly common pattern for people who used the old app on Windows (where we didn't have magic stashing) was to commit everything with a commit summary of wip or something similar and then, when returning to the branch, simply undo the latest change. This flow still works in the new application and may be used as a workaround as this issue is discussed.

    Here's a quick demo

  2. ebrearley commented on May 22, 2017

    @ebrearley

    A temporary wip commit is fine as long as my changes aren't super out there and causing issues with linting and/or tests which can be run from the pre-commit hook (on repo's with this configured).

    Thanks for the great tip though!

  3. beauallison commented on May 24, 2017

    @beauallison

    +1 with @ebrearley - pre-commit hooks make this difficult and I often resort to stashing through the CLI - would love this functionality returned.

  4. niik commented on May 24, 2017

    @niik
    Member

    A temporary wip commit is fine as long as my changes aren't super out there and causing issues with linting and/or tests which can be run from the pre-commit hook (on repo's with this configured).

    I hadn't considered hooks. That's certainly a scenario where that flow breaks down. Thank you @ebrearley and @beauallison for that perspective!

  5. fallanic commented on May 24, 2017

    @fallanic

    Totally agree with @lameyer , magic stash and the ability to easily select lines to commit in a file are the two killer features which made me switch from command line to the desktop app.

    I also agree about at least making the option available somewhere in the settings, but I still personally think it's better to enable it by default.
    Just an idea : if it's confusing some users, why not try adding a small message explaining the magic stash happened, and changes will be "stashed pop" on next checkout of the branch?

    The workaround can work in some cases but it's a bit tedious.
    Also I was wondering, how long do the "commited just now / Undo" message and button stay for?

    Edit : and BTW great job on the beta, the new UI looks pretty cool, and so far it's super stable, not so common for betas 👏

  6. joshaber commented on Jun 29, 2017

    @joshaber
    Contributor

    Thanks for the suggestion!

    This idea is interesting for the future, but this is beyond the scope of our current roadmap.

    I'm going to add the future-proposal label to this issue and close it out, so that we don't get overwhelmed with our backlog! We'll revisit these as part of our next planning session.

  7. fallanic commented on Jun 29, 2017

    @fallanic

    Well it looks like it is on the roadmap already, first and 3rd bullet Feature completeand Replaces existing Desktop apps :trollface:

    Just kidding 🙂 (kind of) but it's too bad the feature was removed, especially if "not many" people where complaining about it (according to #245 ).

    I understand how it could confuse some users without a clear message explaining what just happened, but a handful of people sending emails to support shouldn't outweigh many people who love a feature hence don't contact support.

    I hope the feature comes back in the near future, and kudos again on a great beta 👍

  8. j-f1 commented on Jun 29, 2017

    @j-f1
    Contributor

    @fallanic It wasn’t removed per se — they removed all of the features by starting over with a completely new codebase.

  9. fallanic commented on Jun 29, 2017

    @fallanic

    I meant "dropped" sorry

  10. TytaniumDev commented on Jul 12, 2017

    @TytaniumDev

    Just wanted to add that I also really miss this feature, I had been using the old desktop client for so long that I thought this was just how git behaved! I agree this is probably best as a setting too.

    If there's a better way to track general interest for a future proposal other than just leaving a comment like this let me know. I didn't see a way to star or +1 it.

  11. threadhead commented on Sep 7, 2017

    @threadhead

    Hate to "me too" this, but I really, really miss this feature. I am typically working on 3-12 branches at any one time and need to quickly switch between. I may switch back to the old Mac version just for this feature alone.

  12. adamreisnz commented on Sep 19, 2017

    @adamreisnz

    I'd also really like to see this put on the roadmap again. It's what made the previous app great -- being able to switch branches without thinking or worrying about your wip files.

    Now, I'm being nagged by a popup and have to go to the CLI and type commands, which takes me out of my work flow and unnecessarily wastes time.

    The wip commit, while maybe a good work around for some cases, is like others pointed out a problem if:

    • you are using deploy hooks,
    • others rely on a stable branch to work on,
    • you want a clean commit history.
  13. 57 remaining items

  14. nitinsingh-cb commented on Nov 26, 2018

    @nitinsingh-cb

    Why not have an option of custom action where you can apply any git command to a selected set of lines? You can then chose to discard, save, compare, edit or whatever. You only need to know the correct git command :)

  15. pomplesiegel commented on Feb 1, 2019

    @pomplesiegel

    I really miss the stashing behavior as well! I thought I was going crazy recollecting how the software previously behaved.

  16. GriffinSauce commented on Feb 5, 2019

    @GriffinSauce

    I too would love to have this feature back, maybe as an option. It was a massive speed boost compared to more "raw" git interactions.

    On the other hand I understand the hesitation noted, it would definitely help to make it more visible (like the contextual button instead of sync).

  17. billygriffin commented on Feb 5, 2019

    @billygriffin
    Contributor

    Hi folks! We're looking at this in #6107 - we're referencing all the feedback here as well, just for context, but just wanted to let y'all know where that work is happening. It is prioritized on our roadmap so it's definitely something we're working on in the next couple months.

  18. Thaina commented on Jun 5, 2020

    @Thaina

    +1 for this. This is very common scenario for switching branch. Why this was closed?

  19. adamreisnz commented on Jun 5, 2020

    @adamreisnz
  20. Thaina commented on Jun 5, 2020

    @Thaina

    @adamreisnz Really? I may not updated things for too long just try to use it and still don't work in my machine

  21. adamreisnz commented on Jun 5, 2020

    @adamreisnz
  22. shamimmirzai commented on Jun 5, 2020

    @shamimmirzai

    The option to auto-stash is present in the new client which is great, but it doesn't auto-restore when I switch back to that branch, which the old client does.

  23. adamreisnz commented on Jun 5, 2020

    @adamreisnz
  24. jnettels commented on Sep 16, 2021

    @jnettels

    I do not use GitHub Desktop myself, but recommended it to some new users because I thought it would be more approachable than the command line. Then I had multiple incidents where these users thought they had lost data - because of the "magic stashing". Once we found the stash everything was fine, but they (obviously) had no idea what a stash was and how they could retrieve the data. In my opinion this should be turned off by default, until the user is educated about how to use it.

    Can you actually turn it off?

  25. agarny commented on Sep 16, 2021

    @agarny

    In my opinion this should be turned off by default, until the user is educated about how to use it.

    I imagine this is never going to happen and thank god for that. I hate it when I install a piece of software and the first thing I have to do is to turn some "basic" features. I can't remember, but doesn't GH Desktop pops up a message when magic stashing is first triggered? If not then this is the behaviour I would probably go for.

  26. billygriffin commented on Sep 20, 2021

    @billygriffin
    Contributor

    Hi folks, just to be clear, "magic stashing" (in other words, stashing automatically without asking) is not enabled by default. The default behavior is that when someone switches branches, they're given the option to bring changes to the new branch or stash the changes on their current branch. If they want to change that, this option is in Preferences:

    Screen Shot 2021-09-20 at 7 34 29 AM

  27. agarny commented on Sep 20, 2021

    @agarny

    Hi folks, just to be clear, "magic stashing" (in other words, stashing automatically without asking) is not enabled by default. The default behavior is that when someone switches branches, they're given the option to bring changes to the new branch or stash the changes on their current branch. If they want to change that, this option is in Preferences:

    Oh, I had forgotten about that. Much better indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions