summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2011-12-16 12:43:06 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2011-12-16 12:52:05 +0100
commitd1ac28dfbb741f1771262bf5e19888cb996f2fcd (patch)
tree09c815e3daf007b0506644cbf6bbf90f2959c26d /bin
parent5ec1a1dff4783437ba8f6b22db166aa10a1e9e69 (diff)
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.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/git-new-workdir4
1 files changed, 4 insertions, 0 deletions
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