sublime_merge icon indicating copy to clipboard operation
sublime_merge copied to clipboard

Add ability to stash individual files

Open warmwaffles opened this issue 7 years ago • 7 comments

Problem description

When I am working on a feature branch, sometimes I get a little carried away and begin working on something that needs to be isolated from the rest of the pack, but only realize it too late. Right now stashing just stashes the entire set of unstaged or indexed files.

Preferred solution

An ability to selectively stash hunks or whole files to be applied to another branch later.

Alternatives

Ability to break out individual files into a new branch.

warmwaffles avatar Sep 27 '18 17:09 warmwaffles

... and individual lines, so that stashing works with the same amount features as staging.

deathaxe avatar Sep 27 '18 19:09 deathaxe

and individual lines, so that stashing works with the same amount features as staging.

That is true, I have been having to add a temporary commit with the staged lines. stash all other changes, reset back one step, stash it, go to new branch, pop stash and commit, then go back to the previous branch and pop my stash back onto the branch.

warmwaffles avatar Sep 27 '18 19:09 warmwaffles

Would love this as well. Ideally with a hotkey similar to shift+return that will instead of staging an active diff, would stash it. Perhaps cmd+shift+return.

nikivdev avatar Aug 31 '20 08:08 nikivdev

Being able to stash individual files/hunks/lines would be extremely useful, especially if you could incrementally go through add to the "same" stash without needing to go through the stash options for each file/hunk/line, similar to how git stash -p works.

willrowe avatar Feb 18 '22 13:02 willrowe

Today I learned that git stash -p exists.

warmwaffles avatar Feb 18 '22 14:02 warmwaffles

Honorable mention: git stash push -- some_pathspec (Note: This does not work with git stash save.)

michaelblyons avatar Aug 25 '22 20:08 michaelblyons

FWIW I achieve partial stashing by first staging the changes then using the Stash --staged command.

ziadkh0 avatar Nov 08 '22 15:11 ziadkh0