From: Junio C Hamano Date: Tue, 13 Oct 2009 08:01:04 +0000 (-0700) Subject: Merge branch 'maint-1.6.4' into maint X-Git-Tag: v1.6.5.1~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6ff9ae9f97101c30897332f608f35ad232b1faf2?hp=-c Merge branch 'maint-1.6.4' into maint * maint-1.6.4: git-stash documentation: mention default options for 'list' --- 6ff9ae9f97101c30897332f608f35ad232b1faf2 diff --combined Documentation/git-stash.txt index 3f14b727b8,3ff653de84..fafe728f89 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@@ -13,7 -13,7 +13,7 @@@ SYNOPSI 'git stash' drop [-q|--quiet] [] 'git stash' ( pop | apply ) [--index] [-q|--quiet] [] 'git stash' branch [] -'git stash' [save [--keep-index] [-q|--quiet] []] +'git stash' [save [--patch] [-k|--[no-]keep-index] [-q|--quiet] []] 'git stash' clear 'git stash' create @@@ -42,27 -42,15 +42,27 @@@ is also possible) OPTIONS ------- -save [--keep-index] [-q|--quiet] []:: +save [--patch] [--[no-]keep-index] [-q|--quiet] []:: Save your local modifications to a new 'stash', and run `git reset - --hard` to revert them. This is the default action when no - subcommand is given. The part is optional and gives - the description along with the stashed state. + --hard` to revert them. The part is optional and gives + the description along with the stashed state. For quickly making + a snapshot, you can omit _both_ "save" and , but giving + only does not trigger this action to prevent a misspelled + subcommand from making an unwanted stash. + If the `--keep-index` option is used, all changes already added to the index are left intact. ++ +With `--patch`, you can interactively select hunks from in the diff +between HEAD and the working tree to be stashed. The stash entry is +constructed such that its index state is the same as the index state +of your repository, and its worktree contains only the changes you +selected interactively. The selected changes are then rolled back +from your worktree. ++ +The `--patch` option implies `--keep-index`. You can use +`--no-keep-index` to override this. list []:: @@@ -78,7 -66,8 +78,8 @@@ stash@{1}: On master: 9cc0589... Add gi ---------------------------------------------------------------- + The command takes options applicable to the 'git-log' - command to control what is shown and how. See linkgit:git-log[1]. + command to control what is shown and how. If no options are set, the + default is `-n 10`. See linkgit:git-log[1]. show []:: @@@ -126,8 -115,7 +127,8 @@@ no conflicts clear:: Remove all the stashed states. Note that those states will then - be subject to pruning, and may be difficult or impossible to recover. + be subject to pruning, and may be impossible to recover (see + 'Examples' below for a possible strategy). drop [-q|--quiet] []:: @@@ -230,20 -218,6 +231,20 @@@ $ edit/build/test remaining part $ git commit foo -m 'Remaining parts' ---------------------------------------------------------------- +Recovering stashes that were cleared/dropped erroneously:: + +If you mistakenly drop or clear stashes, they cannot be recovered +through the normal safety mechanisms. However, you can try the +following incantation to get a list of stashes that are still in your +repository, but not reachable any more: ++ +---------------------------------------------------------------- +git fsck --unreachable | +grep commit | cut -d\ -f3 | +xargs git log --merges --no-walk --grep=WIP +---------------------------------------------------------------- + + SEE ALSO -------- linkgit:git-checkout[1],