when creating linked clone with branch, make sure to ff to the current state

the git-new-workdir helper is mostly useful to have one pristine clone
where the updates get pulled into & from that you create working copies.
As pulling to that master copy only updates the current branch (usually
master), checking out a different branch using git-new-workdir will
result in "your branch is behind the remote branch by xx commits" when
there have been commits after the branch was first checked out locally.

Thus this change adds a fast-forwarding merge when a branch is given.
This commit is contained in:
Christian Lohmaier
2011-12-16 12:43:06 +01:00
parent 2c05867b7d
commit acbde813a7

View File

@@ -80,3 +80,7 @@ cp "$git_dir/HEAD" .git/HEAD
# checkout the branch (either the same as HEAD from the original repository, or
# the one that was asked for)
git checkout -f $branch
if test -n "$branch"
then
git merge --ff-only '@{upstream}'
fi