All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] git branch: add -s/--switch to create and switch to a new branch
@ 2026-11-03 15:34 Johannes Welsch
  2026-11-03 17:57 ` Pushkar Singh
  2026-11-03 19:46 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Welsch @ 2026-11-03 15:34 UTC (permalink / raw)
  To: git

Hi,

I'd like to propose adding a -s (--switch) option to `git branch`.

It makes sense semantically to create a branch and to also switch to it.

Currently, creating a new branch and immediately switching to it requires:

git switch -c newbranch


I'd like to propose an alternative:

git branch -s newbranch


My reasoning is simple: when I want to create a new branch, git branch
is naturally the command I think of.

I want to create a branch and also switch to it. For me, switching is
an additional action when creating the branch, rather than the primary
operation.

The proposed option would behave like git switch -c, creating the
branch and switching to it in one operation. It would fail if the
branch already exists, just as git switch -c does.

I understand that git switch -c already supports this functionality,
but I think the alternative syntax would be more intuitive for users
who approach the operation from the branch-creation perspective.

Thanks!
Johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-03 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 15:34 [RFC] git branch: add -s/--switch to create and switch to a new branch Johannes Welsch
2026-11-03 17:57 ` Pushkar Singh
2026-11-03 19:46 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.