Improve workflows with uncommitted changes
See original GitHub issueWe’ve heard a lot that users want to be able to stash changes in the working directory and that they have to leave GitHub Desktop and do this on the command line. We wanted to take the opportunity to clarify the problem statements as we explore potential paths forward in solving the problems.
More about the history of these problems and how people are experiencing them can be found in #1633 and #2304.
-
I realized after I started doing work that I actually wanted to be doing that work on a different branch. I want to be able to switch branches and retain the uncommitted changes I’ve made without having to leave GitHub Desktop.
-
I’m doing work on a branch, and something comes up where I need to temporarily go to a different branch to do something entirely different. I’m forced to either WIP commit my work and undo it when I come back or leave Desktop to stash it temporarily. I want to just be able to switch branches, do whatever I needed to do, and come back with my changes right where I left them.
-
When I pull from the remote and there are uncommitted changes, if the uncommitted changes conflict with the commits I’m attempting to pull, I’m not able to pull unless I either commit or stash my changes and deal with the conflicts later. This is true for both regular
git pull
andgit pull --rebase
. We’ve decided that this is not in scope for our initial work.
Of note, we had a feature on an earlier version of GitHub for Mac that attempted to solve problem 2 with “magic stashing,” which auto-stashed your uncommitted changes on a current branch when you switched branches, and auto-popped them when you returned to the original branch.
@shiftkey noted some pitfalls with this approach (capturing here so we consider them in any proposed solutions):
- “Magic stashing didn’t restore uncommitted changes after syncing”
- “Magic stashing can fail to restore changes with no indication that they still exist”
- “Magic stashing may delete ignored files”
- “Magic stashing fails if untracked files conflict”
- “Magic stashing information will be lost if a repository moves on disk”
The first two problems are almost certainly related and should not be considered in isolation.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:29
- Comments:65 (28 by maintainers)
Designs
Hey all! Here’s a general idea for the current design direction for uncommitted changes and stashing. This is where we’ve landed after a few rounds and internal discussion, but this is very much still open for feedback.
Problems to solve
To reiterate from above…
I have uncommitted changes. I want to:
Where does this fall on a spectrum from:
Literally stashing <--------------------X-------------------> Magic
Through exploring this, we felt that too magic hid too much of what was going on, and wouldn’t teach users about important concepts. But, leaning too much into stashing felt too advanced and unintuitive.
Constraints
We’ve talked about starting with these constraints to simplify what we’re grappling with:
Main flow
Here’s the main, happy path flow. In this scenario, imagine this is someone working on a feature branch who wants to move to master, and wants their changes to stay on the feature branch.
Overwriting a stash
Considering we’re only going to show a single stash, if a user initiates a new stash, we’ll need to warn them.
Running into conflicts
It’s possible when applying stashes that users will run into conflicts. We can warn them about these like so:
Applying a stash with uncommitted changes
Git actually will throw an error if you try to apply a stash when you have other uncommitted changes. So in this case, we can disable the
Apply
button and show a note why.Here’s an overview of all the screens I showed here if you want to poke around in detail:
Clarifications
Desktop will lose knowledge of that stash, but this feels like such an edge case that we don’t intend to solve for it unless it becomes a broader problem.
For now, we’ll use the current default behavior of Git and how Desktop handles it today. If it becomes a problem people are having issues with, we’ll address it after shipping v1.
The stash remains in the list and available via the CLI, but it’s no longer visible in Desktop.
Feedback
Apply
,Pop
? Maybe we can abstract these to icons to avoid confusion.Open to any and all comments! ✨
stashing or rebasing my branch on top of master are maybe 80% of the cases that I switch to the CLI for