If you see it

Live for passion

Git Branch

Browse all the branches: git branch --all or git branch -a

Browse only remote branches: git branch -r

Delete local branch: git brach -d BRANCH_NAME or git brach -D BRANCH_NAME if it states ‘error: The branch xxx is not fully merged’ and you really don’t care about what’s in that branch.

Note: git brach -d BRANCH_NAME_1 BRANCH_NAME_2 BRANCH_NAME_3 to delete multiple branches at the same time is ok.

Delete remote branch: git push origin :REMOTE_BRANCH_NAME or git branch -r -d origin/REMOTE_BRANCH_NAME

Note: if you see ‘error: unable to delete xxx: remote ref does not exist’, try to do git fetch -p origin to sync your local repo and origin master repo. -p will delete any tracking branches locally that no longer in remote.

Comments