branch: introduce --set-upstream-to
authorCarlos Martín Nieto <cmn@elego.de>
Mon, 20 Aug 2012 13:47:38 +0000 (15:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Aug 2012 21:18:02 +0000 (14:18 -0700)
commit6183d826ba62ec94ccfcb8f6e3b8d43e3e338703
tree6f951b43796c4d0a2b21a11b74132c81b4915c25
parent889d35899ba64640e47798681ecb34a4be043bad
branch: introduce --set-upstream-to

The existing --set-uptream option can cause confusion, as it uses the
usual branch convention of assuming a starting point of HEAD if none
is specified, causing

    git branch --set-upstream origin/master

to create a new local branch 'origin/master' that tracks the current
branch. As --set-upstream already exists, we can't simply change its
behaviour. To work around this, introduce --set-upstream-to which
accepts a compulsory argument indicating what the new upstream branch
should be and one optinal argument indicating which branch to change,
defaulting to HEAD.

The new options allows us to type

    git branch --set-upstream-to origin/master

to set the current branch's upstream to be origin's master.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-branch.txt
builtin/branch.c
t/t3200-branch.sh