Skip to content

Commit dcd0409

Browse files
author
Junio C Hamano
committed
Merge branch 'jc/pull' into next
* jc/pull: git-pull: reword "impossible to fast-forward" message. git-pull: further safety while on tracking branch.
2 parents 8ff8eea + 8323124 commit dcd0409

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

git-pull.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,17 @@ then
5555
# First update the working tree to match $curr_head.
5656

5757
echo >&2 "Warning: fetch updated the current branch head."
58-
echo >&2 "Warning: fast forwarding your working tree."
58+
echo >&2 "Warning: fast forwarding your working tree from"
59+
echo >&2 "Warning: $orig_head commit."
60+
git-update-index --refresh 2>/dev/null
5961
git-read-tree -u -m "$orig_head" "$curr_head" ||
60-
die "You need to first update your working tree."
62+
die 'Cannot fast-forward your working tree.
63+
After making sure that you saved anything precious from
64+
$ git diff '$orig_head'
65+
output, run
66+
$ git reset --hard
67+
to recover.'
68+
6169
fi
6270

6371
merge_head=$(sed -e '/ not-for-merge /d' \

0 commit comments

Comments
 (0)