터미널에서 브랜치 도움말을 보려다가 실수로 브랜치를 생성하고 원격저장소(remote)에 올리고 말았다.

ZMBP:mobile zeidepeace$ git help branch
브랜치 도움말 보기
ZMBP:mobile zeidepeace$ git branch help 
help라는 이름의 브랜치 생성하기


브랜치를 삭제하는 명령어는 

ZMBP:mobile zeidepeace$ git branch [-d|-D]


-d는 모두 머징이 된 상태여야 브랜치가 삭제가 되며 -D는 머징하고 상관없이 브랜치가 삭제된다.

브랜치를 삭제하고 전체리스트(-a)를 확인하면

ZMBP:mobile zeidepeace$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/help


로컬저장소에서는 삭제가 되었는데 원격저장소에 올라간 브랜치는 삭제되지 않고 남아있는게 보인다.

http://help.github.com/remotes/ 에서 찾아보면 원격저장소에 올라간 브랜치/태그를 삭제하는 방법이 나와있다.

 

ZMBP:mobile zeidepeace$ git push origin :help
remote: fatal: bad object 0000000000000000000000000000000000000000
remote: bb/acl: hyo is allowed. accepted payload.
remote: fatal: bad object 0000000000000000000000000000000000000000
To git@bitbucket.org:d/mobile.ios.git
 - [deleted]         help 


다시 확인하면 

ZMBP:mobile zeidepeace$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master 


브랜치가 삭제된 것을 알 수 있다.

Posted by zeide
,