4 ms·
> Just as one example, automatically stashing and unstashing when switching branches is so obviously convenient, in hindsight I'm puzzled as to why git doesn't
by deathanatos 6y ago
> Just as one example, automatically stashing and unstashing when switching branches is so obviously convenient, in hindsight I'm puzzled as to why git doesn't just do this automatically.
Yeah, I too have wished for this. Do note that that can fail, if there are conflicts, so you'd have to decide whether to fail the command (like today) or to drop the user into conflict resolution.
- hvdijk 6y agoThat's the exception, though. If the changes are automatically stashed when you switch away from a branch, restored when you switch back, and operations that act on branches require you to first switch to that branch, the stash and branch won't get out of sync, the stash will be right on top of the branch. Conflicts shouldn't happen unless you do weird things like reset a branch (git checkout -B) or update it directly without checking it out (git update-ref), in which case you might not even need conflict resolution, such operations might just be specified to immediately drop the stash.
- jmchuster 6y agoI've used Tower for a couple of years, and that's exactly what it does. Auto-stash, re-apply stash when switching branches, and then you have to resolve the merge conflict in the UI if it doesn't re-apply cleanly. Or you just stash if you didn't actually want to re-apply those changes after all, but I've found the default to re-apply to be what I wanted the majority of the time.