šš¢š šš«šš§šš” ššØš¦š¦šš§š
Megha Sharma
Posted on October 9, 2024
The š š¢š šš«šš§šš”
command in Git is used for managing branches within a repository. It provides various functionalities to create, list, delete, and manipulate branches. Below are some common use cases for the š š¢š šš«šš§šš”
command:
š šš«šššš š ššš° šš«šš§šš”
š š¢š šš«šš§šš” <šš«šš§šš”_š§šš¦š>
Creates a new branch with the specified name.
š š¢š šš”ššš¤šØš®š -š <šš«šš§šš”_š§šš¦š>
Creates and switches to a new branch in one command.
š šš°š¢ššš” šš«šš§šš”šš¬
š š¢š šš”ššš¤šØš®š <šš«šš§šš”_š§šš¦š>
Switches to the specified branch.
š š¢š š¬š°š¢ššš” <šš«šš§šš”_š§šš¦š>
Switches to the specified branch (Git version 2.23 and later).
š ššš«š š šš«šš§šš”šš¬
š š¢š š¦šš«š š <šš«šš§šš”_š§šš¦š>
Merges changes from the specified branch into the current branch.
š šš¢š¬š šš«šš§šš”šš¬
š š¢š šš«šš§šš”
Lists all the branches in the repository. The current branch is highlighted with an asterisk (*
).
š šš«šššš šš§š šš°š¢ššš” ššØ š ššš° šš«šš§šš”
š š¢š šš”ššš¤šØš®š -š <š§šš°_šš«šš§šš”_š§šš¦š>
Creates a new branch with the specified name and switches to it in a single command. (Or, using š š¢š š¬š°š¢ššš” -š <š§šš°_šš«šš§šš”_š§šš¦š>
in Git versions 2.23 and later.)
š ššš§šš¦š š šš«šš§šš”
š š¢š šš«šš§šš” -š¦ <š§šš°_šš«šš§šš”_š§šš¦š>
Rename the current branch.
š š¢š šš«šš§šš” -š¦ <šØš„š_šš«šš§šš”_š§šš¦š> <š§šš°_šš«šš§šš”_š§šš¦š>
Rename a specific branch.
š ššš„ššš š šš«šš§šš”
š š¢š šš«šš§šš” -š <šš«šš§šš”_š§šš¦š>
Deletes the specified branch. The -š
option ensures that the branch has been fully merged before deletion. If the branch contains unmerged changes, Git will prevent deletion.
š š¢š šš«šš§šš” -š <šš«šš§šš”_š§šš¦š>
Forces deletion of the specified branch, even if it contains unmerged changes.
š šš¢šš° ššš¦šØšš šš«šš§šš”šš¬
š š¢š šš«šš§šš” -š«
Lists remote branches (branches on the remote repository).
š šš¢šš° šš„š„ šš«šš§šš”šš¬ (ššØššš„ šš§š ššš¦šØšš)
š š¢š šš«šš§šš” -š
Lists both local and remote branches.
š šš”šØš° šš®š«š«šš§š šš«šš§šš”
š š¢š šš«šš§šš” ā š¬š”šØš°-šš®š«š«šš§š
Displays the name of the currently checked-out branch.
š šš¢šš° šš”š ššš¬š ššØš¦š¦š¢š šØš§ šššš” šš«šš§šš”
š š¢š šš«šš§šš” -šÆ
Shows the last commit on each branch along with the commit message.
Posted on October 9, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.