Articles → GIT → Branches in git

Branches in git






What are branches?







How to get the list of all branches?




git branch –a

Or 

git branch


Picture showing the command to get the list of all brances in git

Click to Enlarge


Master branch





How to create a new branch?




git branch <branch_name>




Picture showing the git branch command to create a new branch in git

Click to Enlarge


How to switch between branches?




git checkout <branch_name>


Picture showing the git checkout command to switch between the branches in git

Click to Enlarge


How to delete a branch?




git branch –D <branch_name>


Picture showing the command to delete the branch in git

Click to Enlarge


Create and check-in the branch in one command




git checkout –b <branch_name>




Picture showing the command to create and switch the branch in git

Click to Enlarge


How to rename a branch?




git branch –m <new branch name>




git branch –m <old branch name> <new branch name>



Posted By  -  Karan Gupta
 
Posted On  -  Thursday, August 1, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250