A branch represents an independent line of development. Branches serve as an abstraction for the edit/stage/commit process discussed.

The git branch command lets you create, list, rename, and delete branches. It doesn’t let you switch between branches or put a forked history back together again. For this reason, git branch is tightly integrated with the git checkout and git merge commands.

#List all of the branches in your repository.
git branch

#create a new branch called branch
git branch 

#list out remote branch by using -r flag
git branch -r

#Force delete the specified branch, even if it has unmerged changes. 
git branch -D 

#Rename the current branch to .
git branch -m old_branch new_branch
git push origin :old_branch // Delete old branch
git push --set-upstream origin new_branch 

Leave a Reply

Your email address will not be published. Required fields are marked *