I am looking for a GUI for stashing and stash popping files in git, with the ability to do so for individual modified files. I know there is a command line way to do so, seen here, but I am looking for a graphical way. I don't care so much about stashing individual files, but more about popping/applying. I am running on Windows 7.
-
Unfortunately, your question is off-topic. Stack Overflow is not about software recommendations. – jub0bs Apr 14 '15 at 19:31
-
1@Jubobs, okay, I thought of it as a "I need a way to solve my specific problem", not "which git gui client is the best". – Chance Apr 14 '15 at 19:39
-
Your OS? On Windows, GitExtensions could do that... – Philippe Apr 14 '15 at 20:33
-
@Philippe, Windows (I just added to question). Now that you mention it, I can select the stash in my tree and probably copy files over that way. Other than that, I'm not sure how to do individual files. – Chance Apr 14 '15 at 20:38
-
1You have a problem but you are looking for the solution in the wrong direction. [`git stash`](http://git-scm.com/docs/git-stash) was designed for a different thing (it is explained in the first paragraph of its documentation). You can do what you want (and in a more flexible way than stashing) if you create a new branch and commit the changes on it (in any amount of combination you want) until you reach the status you desire. Then just checkout the previous branch and you're done. – axiac Apr 15 '15 at 08:36
-
1@axiac, I think you are right. I'm using git coming from Perforce, so I'm trying to make stash fit in the 'shelve' mold, but I think branching is the better way to do it. Tied to this is that git extensions sort of makes a branch out of my stashes, so I may be able to stash but treat it like a branch when grabbing individual files. – Chance Apr 15 '15 at 13:09
-
@axiac, if you post that as your answer I'll accept. – Chance Apr 27 '15 at 20:08
3 Answers
I saw a recommendation here to add the Stash commands as a menu to "Git GUI" in your <USER HOME directory>\.gitconfig
.
[guitool "Stash/show"]
cmd = git stash show -p
[guitool "Stash/list"]
cmd = git stash list
[guitool "Stash/pop"]
cmd = git stash pop
[guitool "Stash/drop"]
cmd = git stash drop
confirm = yes
I also added one more command to do the stashing (to use, you must first stage--but not commit--the files you wish stashed in order for Git to perform the required "add"):
[guitool "Stash"]
cmd = git stash
(Note that I chose to have "stash" not appear as a submenu, but you could do so.)
You can also add commands through Git GUI itself via Tools->Add.
Stashing can be helpful if you just want to put the files out of mind quickly without bothering to think of a branch name.

- 47,466
- 33
- 109
- 111

- 14,034
- 6
- 54
- 77
The documentation of git stash
says:
Use
git stash
when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match theHEAD
commit.
It provides very little support1 to handle individual files because its purpose is to safely store your current changes and quickly bring your working tree to a clean state (i.e. as it was immediately after your last commit on the current branch).
You can do what you want (and in a more flexible way than stashing) if you create a new branch and commit the changes on it (in any amount or combination you want) until you reach the status you desire. Then just checkout the previous branch and you're done.
This approach allows you to merge the changes into the current branch later, to cherry-pick only some commits or even some files from them.
1 git stash save
provides the option --patch
that allows the user to interactively selects hunks from the diff between HEAD
and the working tree to be stashed. It allows fine control over what is added to the stash.
Extra discussion
You say:
I'm using
git
coming fromPerforce
, so I'm trying to make stash fit in the 'shelve' mold, but I think branching is the better way to do it. Tied to this is thatgitextensions
sort of makes a branch out of my stashes, so I may be able to stash but treat it like a branch when grabbing individual files.
Internally, each stash is stored as a commit linked to the commit that was the HEAD
at the moment when the stash was created, but not linked to the previous stash (if any). The list of stashes is stored as meta-data; the stashes are not linked in a (hidden) branch.
More, git stash create
allows the creation of a stash without adding it into the list of stashes. It is provided for scripting and "probably not the command you want to use" (I quoted from the documentation).

- 68,258
- 9
- 99
- 134
-
thanks. To clarify, I don't think the stash really is like a branch, but git extensions makes it appear so - which can be good or bad. git extensions provides a layer of abstractions, and sometimes it's not exactly clear what I'm doing. – Chance Apr 28 '15 at 14:34
-
Indeed, [gitextensions](https://code.google.com/p/gitextensions/) makes the list of stashes look like a branch; while this can help the beginners accommodate with `git` easier, it misleads them later. [SourceTree](http://www.sourcetreeapp.com) presents the stashes as independent objects, the same way it shows the branches, the tags and the remotes. Give it a try (it's free), maybe you'll like it. It is also a Mercurial client. – axiac Apr 28 '15 at 14:51
-
"The list of stashes is stored as meta-data" - as far as I can see in the refs/logs/stash basically. What is `git save` you refer to ? – Mr_and_Mrs_D Jun 05 '17 at 10:43
-
1@Mr_and_Mrs_D it should have been `git stash save`, I forgot the `stash` when I wrote the answer. I fixed it now. Thank you for pointing it out. – axiac Jun 05 '17 at 11:07
Did you try Sourcetree: http://www.sourcetreeapp.com/
It might solve your problem.

- 311
- 1
- 8
-
3SourceTree is a good `Git` GUI client but it cannot stash individual files. Maybe this is because the `stash` command was not designed to work this way? – axiac Apr 15 '15 at 08:33