summaryrefslogtreecommitdiff
path: root/bin/git-new-workdir
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:43:06 +0100
commitacbde813a714d0cfa7f3a4179dfbb6aada3e3f1b (patch)
treef5fa9320c58e2b5381435e99a4d9b9143ee744b5 /bin/git-new-workdir
parent2c05867b7dc8d78618668ab5e0e5e1139895b875 (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/git-new-workdir')
-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