summaryrefslogtreecommitdiff
path: root/git-checkout.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-16 20:46:39 -0800
committerJunio C Hamano <junkio@cox.net>2007-01-16 21:32:06 -0800
commitc1a4278ee3f99ca9db94bd032b047b3d19ac6e5f (patch)
tree1122009dda16c2a8a31851018c921dd9a9538afc /git-checkout.sh
parent7905ba626e14c32d09a412c168931486ceedb6ec (diff)
downloadgit-c1a4278ee3f99ca9db94bd032b047b3d19ac6e5f.tar.gz
Use merge-recursive in git-checkout -m (branch switching)
This allows "git checkout -m <other-branch>" to notice renames and carry local changes in the working tree forward. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-checkout.sh')
-rwxr-xr-xgit-checkout.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/git-checkout.sh b/git-checkout.sh
index 66e40b90eb..e02d4d87f6 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -201,8 +201,9 @@ else
git diff-files --name-only | git update-index --remove --stdin &&
work=`git write-tree` &&
git read-tree --reset -u $new &&
- git read-tree -m -u --aggressive --exclude-per-directory=.gitignore $old $new $work ||
- exit
+ eval GITHEAD_$new=${new_name:-${branch:-$new}} GITHEAD_$work=local &&
+ export GITHEAD_$new GITHEAD_$work &&
+ git merge-recursive $old -- $new $work || exit
if result=`git write-tree 2>/dev/null`
then