![]() ![]() Note: The commit message will only be in this form (starting with "WIP on") if you did not supply a message when you did git stash. WIP on somebranch: commithash Some old commit message To spot stash commits, look for commit messages of this form: ![]() You can replace gitk there with something like git log -graph -oneline -decorate if you prefer a nice graph on the console over a separate GUI app. This will launch a repository browser showing you every single commit in the repository ever, regardless of whether it is reachable or not. or see the answer from emragins if using Powershell for Windows. Otherwise, you can find it using this for Linux, Unix or Git Bash for Windows: git fsck -no-reflog | awk '/dangling commit/ ' ) 2 Answers Sorted by: 2 You can : discard your current changes (for example : git checkout. If you have only just popped it and the terminal is still open, you will still have the hash value printed by git stash pop on screen (thanks, Dolda). When you’re done, just blow the branch away. Or, you can create a separate branch for it with git branch recovered $stash_hashĪfter that, you can do whatever you want with all the normal tools. Once you know the hash of the stash commit you dropped, you can apply it as a stash: git stash apply $stash_hash īut, if you just want to visually check the staged changes only, you can try difftool: git difftool -cached repeat above five steps until one commit remains. $ git stash pop # prepare to work on all other changes $ git commit -m 'First part' # commit fully tested change $ git stash save -keep-index # save all other changes to the stash ![]() $ git add -patch foo # add just first part to the index More commits out of the changes in the work tree, and you want to testĮach change before committing: #. You can use git stash save -keep-index when you want to make two or If the -keep-index option is used, all changes already added to the index are left intact: git stash -keep-indexįrom the documentation of git-stash: Testing partial commits Later on, if you wanted to remove that stash, you can use the git stash drop command to do so If you use GIT regularly, I recommend to get this book and have. If you think it's not working please also mention your git version. I tested my answer again today () against git version 2.24.0, and I still believe that it's correct, I added a small note above about the untracked files. Then the ignored files are stashed and cleaned in addition to theĮven though this is the selected answer, a lot have pointed out that the () is the correct one, I recommend checking it out. If the -include-untracked option is used, all untracked files areĪlso stashed and then cleaned up with git clean, leaving the workingĭirectory in a very clean state. If the -keep-index option is used, all changes already added to the The full command becomes git stash -keep-index -uĪnd here's a snippet from the git-stash help I'm not sure why people are complaining about this answer, it seems to be working perfectly with me, for the untracted files you can add the -u flag ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |