logo
Menu
š†š¢š­ šš«ššš§šœš” š‚šØš¦š¦ššš§š

š†š¢š­ šš«ššš§šœš” š‚šØš¦š¦ššš§š

"Master Git Branch commands! Streamline version control! #Git #DevOps #VersionControl"

Published Jul 6, 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.
Ā 

1 Comment