2012-05-21 21:22:49 +00:00
|
|
|
#
|
|
|
|
# Recovers dropped Git stashed states.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
|
2017-07-06 23:01:26 +00:00
|
|
|
# function git-stash-recover {
|
|
|
|
|
2018-03-05 08:56:25 +00:00
|
|
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
2012-09-30 19:30:18 +00:00
|
|
|
print "$0: not a repository work tree: $PWD" >&2
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2012-05-21 21:22:49 +00:00
|
|
|
local commit
|
|
|
|
|
|
|
|
for commit in "$@"; do
|
2018-03-05 08:56:25 +00:00
|
|
|
command git update-ref \
|
|
|
|
-m "$(command git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit"
|
2012-05-21 21:22:49 +00:00
|
|
|
done
|
2017-07-06 23:01:26 +00:00
|
|
|
|
|
|
|
# }
|