Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

Latest commit

 

History

History
25 lines (20 loc) · 806 Bytes

create-branch.md

File metadata and controls

25 lines (20 loc) · 806 Bytes
title type tags cover dateModified
Create a new branch
snippet
branch
remote
flower-pond
2021-04-13 21:10:59 +0300

Creates and switches to a new branch, optionally setting up a remote tracking branch.

  • Use git checkout -b <branch> to create a new branch with the specified name and switch to it.
  • You can optionally add -t <remote>/<branch> to set up a remote tracking branch for the newly created branch.
  • Note: You can alternatively use git branch <branch> [-t <remote>/<branch>] and then git checkout <branch> separately.
git checkout -b <branch> [-t <remote>/<branch>]
git checkout -b patch-1
# Local branch, without a remote tracking branch

git checkout -b patch-2 -t origin/patch-2
# Local branch and remote tracking branch with the same name