Syntax

Untitled Database

Every git repository has one or more branches. A branch is a named reference to the HEAD of a sequence of commits.

A git repo has a current branch (indicated by a \\* in the list of branch names printed by the git branch command), Whenever you create a new commit with the git commit command, your new commit becomes the HEAD of the current branch, and the previous HEAD becomes the parent of the new commit.

A new branch will have the same HEAD as the branch from which it was created until something is committed to the new branch.

Creating and checking out new branches

Listing branches

Delete a remote branch

Quick switch to the previous branch

Check out a new branch tracking a remote branch

Delete a branch locally

Create an orphan branch i.e. branch with no parent commit