Skip to content

docs: add git switch commands to Git cheatsheet - #785

Open
harsh6125 wants to merge 1 commit into
Fechin:mainfrom
harsh6125:docs/add-git-switch
Open

docs: add git switch commands to Git cheatsheet#785
harsh6125 wants to merge 1 commit into
Fechin:mainfrom
harsh6125:docs/add-git-switch

Conversation

@harsh6125

@harsh6125 harsh6125 commented Aug 9, 2026

Copy link
Copy Markdown

What I changed

While going through the Git cheatsheet, I noticed that the branch section uses git checkout for switching to an existing branch and creating a new branch.

I updated these two examples to use the dedicated git switch commands:

  • git switch my_branch — switch to an existing branch
  • git switch -c new_branch — create and switch to a new branch

The reason for this change is that git switch is specifically designed for branch switching and creation, making the commands clearer and easier to understand for people learning Git. git checkout is still a valid Git command, but it is used for several different purposes, whereas git switch makes the branch-related operation more explicit.

I kept the change limited to these two examples in the Git cheatsheet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant