일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 런데이애플워치
- schema-registry
- 일권하는사회
- deepseek
- 중사랑
- 플라스틱은 어떻게 브랜드의 무기가 되는가
- 트럼프2.0시대
- 여행
- sparksql
- 마법의연금굴리기
- 런데이
- 가람집옹심이
- 루스틱
- 마연굴
- Zone2
- 티지아이포럼
- apollo-server-v3
- 강릉여행
- 달리기
- 송고버섯피자
- 여니브레드
- parquet
- neovim
- apollo-sandbox
- 이코노미스트한국구독센터
- 한국걱정
- 저동하녹
- 오운완
- kafka-connect
- 잘쉬어야지
- Today
- Total
해뜨기전에자자
git remove local & remote branch 본문
Delete all remote branches of remote {origin} except branch containing 'master'.
But when I run this command on my MacBook , it doesn't work because of the special characters '?]m'.
I searched that char and found it's the expression of ^M (ctrl + C then ctrl + M)
and tried to replace it like sed 's/^M//g' or sed 's/?]m//g', but it doesn't work.
So I did it on my another pc installed centOS.
+++
I found how to do it in my MacBook. I asked my friend whether it works on her MacBook, and she said it works.
Then I found 'format' option. and it works on my laptop.
git branch --format='%(refname:short)' | grep -v master | xargs git push origin --delete
git branch --format='%(refname:short)' | grep -v master | xargs git branch -D
+++
get remote branches
# git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
remove remote branches
# git branch | grep -v master | xargs git push origin --delete
remote local branches
# git branch | grep -v master | xargs git branch -D
In shortly,
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git branch | grep -v master | xargs git push origin --delete
git branch | grep -v master | xargs git branch -D
git branch 삭제하기 삭제
+ 한글로 쓸걸 괜히 영어로 쓰니까 나중에 보니까 금방 눈에 안들어온다. 됴륵