update.sh: reset pre-stash, die if stash fails.
A `git reset --hard` without stashing first risks nuking in-progress work. A `git reset --mixed` should allow stashing to occur more often on e.g. merge conflicts. Fixes #766.
This commit is contained in:
parent
df21e57179
commit
46a3003a2f
@ -226,9 +226,18 @@ merge_or_rebase() {
|
|||||||
fi
|
fi
|
||||||
git merge --abort &>/dev/null
|
git merge --abort &>/dev/null
|
||||||
git rebase --abort &>/dev/null
|
git rebase --abort &>/dev/null
|
||||||
git -c "user.email=brew-update@localhost" \
|
git reset --mixed "${QUIET_ARGS[@]}"
|
||||||
-c "user.name=brew update" \
|
if ! git -c "user.email=brew-update@localhost" \
|
||||||
stash save --include-untracked "${QUIET_ARGS[@]}"
|
-c "user.name=brew update" \
|
||||||
|
stash save --include-untracked "${QUIET_ARGS[@]}"
|
||||||
|
then
|
||||||
|
odie <<EOS
|
||||||
|
Could not `git stash` in $DIR!
|
||||||
|
Please stash/commit manually if you need to keep your changes or, if not, run:
|
||||||
|
cd $DIR
|
||||||
|
git reset --hard origin/master
|
||||||
|
EOS
|
||||||
|
fi
|
||||||
git reset --hard "${QUIET_ARGS[@]}"
|
git reset --hard "${QUIET_ARGS[@]}"
|
||||||
STASHED="1"
|
STASHED="1"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user