A place for my Git tips and tricks. So I don't forget :-)¶
Recovering stashes that were cleared/dropped erroneously using Windows PowerShell
This command is similar to the command listed on the
git-stash man page to list stashes that were cleared or dropped.
git fsck --unreachable | select-string "commit" | foreach { [regex]::replace($_, "^.*?(\w+)$", '$1') } | foreach { git log --no-walk --merges --grep=WIP $_ }Issue Git rm commands for deleted files using Windows PowerShell¶
git status --porcelain | select-string "^ D" | foreach { [regex]::replace($_, "^ D (.*)$", '$1') } | foreach { git rm $_ }