Skip to content

Branching

Zhamri Che Ani edited this page Mar 5, 2019 · 3 revisions

How to:

Listing Local Branch
$ git branch
$ git branch -a

Switching between Local Branch
$ git checkout branch1
$ git checkout -b newBranch

Listing Remote Branch
$ git remote show origin


Creating New Branch

  $ git branch <branch_name>

eg:
  $ git branch stiw3054

Rename Current Branch

  $ git branch -m <branch_name>

eg:
  $ git branch -m stiw3054-RT

Delete Local Branch

  $ git branch -d <branch_name>

eg:
  $ git branch -d stiw3054-RT

Delete Remote Branch

  $ git push <remote_name> --delete <branch_name>

e.g:
  $ git push https://[email protected]/zhamri/STIW3054-RT-Programming.git --delete Exercise08

References:

https://git-scm.com/docs/git-branch