GIT: Branches

How to manage branches in GIT …

To list branches

$ git branch

To list remote branches

$ git branch -r

To list all branches

$ git branch -a

Checkout remote branch

$ git checkout -b [branch_name] origin/[branch_name]

Remove Remote Branch

$ git push [remote] :[branch_name]

Create Branch

$ git push origin master:refs/heads/[branch_name]
$ git fetch origin
$ git branch -r
$ git checkout --track -b [branch_name] origin/[branch_name]
$ git pull
$ git branch

Leave a Reply

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