There are no straightforward ways to do it. The command-line solution in the Stackoverflow link in Seth's answer is useful, but I user my own trick in Sourcetree.
To stash select files:
You can then re-apply the first stash, and discard the files that you wanted to stash.
Great answer. I am sure the command line options work but this was a question on how to do it in SourceTree. Thanks for providing a SourceTree solution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SourceTree also has custom actions, I added a custom action 'Stash selected files', script target 'git.exe', parameters 'stash push $FILE', seems to work and slightly easier once you have te custom action.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Johan Scholten
Hi
been a while, but how does the stash description is determined in this way?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It just uses the default now for me, something with the branch name included. Might be adaptable, never checked that.
You can also put parameters for a default name I guess, but there is no way in SourceTree to have a popup for filling in a name for the stash it seems.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a command line solution. Credit to: http://stackoverflow.com/questions/5506339/how-can-i-git-stash-a-specific-file
git stash --patch
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I submitted a feature request for natively supporting stashing selected files:
https://jira.atlassian.com/browse/SRCTREEWIN-9103
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mac users: please vote on the same feature request for the Mac version: https://jira.atlassian.com/browse/SRCTREE-4765
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ctrl + click the files that you want to stash. You can google the other answer i guess.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm on a Mac. By the way:
- cmd + click: selects deselects a single file for further action
- shift + click: extends selection to that file for further action
- ctrl + click: opens contextual menu (same as right click)
- alt + click: does nothing more than normal left click
So on a Mac none of the previous serves the purpose.
I was asking the shell Git command because I'm not sure if it's even possible to do what I want to (= stash single files).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.