From c1a4278ee3f99ca9db94bd032b047b3d19ac6e5f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 16 Jan 2007 20:46:39 -0800 Subject: Use merge-recursive in git-checkout -m (branch switching) This allows "git checkout -m " to notice renames and carry local changes in the working tree forward. Signed-off-by: Junio C Hamano --- git-checkout.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'git-checkout.sh') 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 -- cgit v1.2.3