From: Eric Sunshine Date: Sun, 25 Mar 2018 04:28:30 GMT Subject: Re: [PATCH] branch -l: print useful info whilst rebasing a non-local branch Message-ID: In-Reply-To: <20180325041056.GA22321@sigill.intra.peff.net> On Sun, Mar 25, 2018 at 12:10 AM, Jeff King wrote: > Alternatively, we could at least detect the situation that confused you: > > diff --git a/builtin/branch.c b/builtin/branch.c > @@ -676,6 +676,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix) > + if (list && reflog) > + die(_("--reflog in list mode does not make sense")); > + > > That doesn't help somebody mistakenly doing "git branch -l foo", but > more likely they'd do "git branch -l jk/*" if they were trying to list > branches (and then "branch" would barf with "that's not a valid branch > name", though that may still leave them quite confused). Assuming that existing clients of "-l" (if there are any) only invoke "git branch -l " to create a new branch, then it would be possible to interpret "-l" as --list when is an existing branch. That is, the "-l" in "git branch -l" and "git branch -l ..." is recognized as --list, and (for backward compatibility only) the "-l" in "git branch -l " is still recognized as --create-reflog. This idea falls flat, however, if there are clients out there which actually depend upon "git branch -l " failing.