From acbde813a714d0cfa7f3a4179dfbb6aada3e3f1b Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Fri, 16 Dec 2011 12:43:06 +0100 Subject: 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. --- bin/git-new-workdir | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bin/git-new-workdir') diff --git a/bin/git-new-workdir b/bin/git-new-workdir index 3ad2c0cea563..137ea082b4ec 100755 --- a/bin/git-new-workdir +++ b/bin/git-new-workdir @@ -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 -- cgit