From: Ramkumar Ramachandra Date: Thu, 20 Jun 2013 16:04:17 GMT Subject: Re: [PATCH] pull: pull into void by fast-forwarding from empty tree Message-ID: In-Reply-To: <45f6841746e5dcea03a97fc3ea24aef274728023.1371731513.git.trast@inf.ethz.ch> Thomas Rast wrote: > diff --git a/git-pull.sh b/git-pull.sh > index 638aabb..1f84383 100755 > --- a/git-pull.sh > +++ b/git-pull.sh > @@ -266,10 +266,17 @@ case "$merge_head" in > ;; > esac > > +# Pulling into unborn branch: a shorthand for branching off > +# FETCH_HEAD, for lazy typers. > if test -z "$orig_head" > then > git update-ref -m "initial pull" HEAD $merge_head "$curr_head" && > - git read-tree -m -u HEAD || exit 1 > + # Two-way merge: we claim the index is based on an empty tree, > + # and try to fast-forward to HEAD. This ensures we will not > + # lose index/worktree changes that the user already made on > + # the unborn branch. > + empty_tree=4b825dc642cb6eb9a060e54bf8d69288fbee4904 Perhaps replace this magic with $(git hash-object -t tree /dev/null) or $(git mktree