]> git.ipfire.org Git - thirdparty/git.git/commit - t/t3200-branch.sh
branch: deprecate --set-upstream and show help if we detect possible mistaken use
authorCarlos Martín Nieto <cmn@elego.de>
Thu, 30 Aug 2012 17:23:13 +0000 (19:23 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Aug 2012 19:07:39 +0000 (12:07 -0700)
commitb347d06bf097aca5effd07871adf4d0c8a7c55bd
tree64a5252be54daea24ec6685b0e9e13caf2a02650
parentb84869ef14081b298a4ab825219221ccfcb2a3ba
branch: deprecate --set-upstream and show help if we detect possible mistaken use

This interface is error prone, and a better one (--set-upstream-to)
exists. Add a message listing the alternatives and suggest how to fix
a --set-upstream invocation in case the user only gives one argument
which causes a local branch with the same name as a remote-tracking
one to be created. The typical case is

    git branch --set-upstream origin/master

when the user meant

    git branch --set-upstream master origin/master

assuming that the current branch is master. Show a message telling the
user how to undo their action and get what they wanted. For the
command above, the message would be

The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to
Branch origin/master set up to track local branch master.

If you wanted to make 'master' track 'origin/master', do this:

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

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