From: Linus Torvalds Date: Tue, 21 Jun 2005 22:40:00 +0000 (-0700) Subject: Remove MERGE_HEAD in "git checkout/reset" X-Git-Tag: v0.99~216 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ef0bfa25e99627b809c0902d21072821955db3fe;p=git.git Remove MERGE_HEAD in "git checkout/reset" Both of these scripts will end up resetting the index to some specific head, and any unresolved merge will be forgotten. --- diff --git a/git-checkout-script b/git-checkout-script index 5b49662e6..870b1a3ef 100755 --- a/git-checkout-script +++ b/git-checkout-script @@ -37,4 +37,15 @@ then git-checkout-cache -q -f -u -a else git-read-tree -m -u $old $new -fi && [ "$branch" ] && ln -sf "refs/heads/$branch" "$GIT_DIR/HEAD" +fi + +# +# Switch the HEAD pointer to the new branch if it we +# checked out a branch head, and remove any potential +# old MERGE_HEAD's (subsequent commits will clearly not +# be based on them, since we re-set the index) +# +if [ "$?" -eq 0 ]; then + [ "$branch" ] && ln -sf "refs/heads/$branch" "$GIT_DIR/HEAD" + rm -f "$GIT_DIR/MERGE_HEAD" +fi diff --git a/git-reset-script b/git-reset-script index eaefd00d9..fe773388c 100755 --- a/git-reset-script +++ b/git-reset-script @@ -1,3 +1,5 @@ #!/bin/sh +: ${GIT_DIR=.git} git-read-tree --reset HEAD git-update-cache --refresh +rm -f "$GIT_DIR/MERGE_HEAD"