Thread View: linux.kernel.git
1 messages
1 total messages
Started by Pushkar Singh
Tue, 03 Nov 2026 17:57
Re: [RFC] git branch: add -s/--switch to create and switch to a new branch
Author: Pushkar Singh
Date: Tue, 03 Nov 2026 17:57
Date: Tue, 03 Nov 2026 17:57
26 lines
11584 bytes
11584 bytes
Hi Johannes, [snip] > 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. I get your point, but wouldn't this introduce some overlap between "git branch" and "git switch"? Currently, we already have "git branch <name>" to create a branch without switching to it, and "git switch <name>" to switch to an existing branch. If you want to create a new branch and switch to it immediately, "git switch -c <name>" already does that. In fact, the git branch documentation[1] itself suggests using "git switch -c" for exactly this use case. [snip] > switching is an additional action when creating the branch, rather than the primary operation. I understand where you're coming from, but isn't this separation between creating and switching branches one of the reasons git switch was introduced in the first place? Would adding this functionality to "git branch" make that distinction a little less clear? Thanks! Pushkar --- [1]: https://git-scm.com/docs/git-branch?#_notes
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads