문제점 : 리모컨이없는 모든 로컬 브랜치를 삭제하는 방법을 원합니다. 브랜치의 이름을으로 파이프하는 것은 쉽지만 git branch -D {branch_name}
처음에 그 목록을 어떻게 얻습니까?
예를 들면 :
리모컨없이 새 분기를 만듭니다.
$ git co -b no_upstream
모든 지점을 나열했는데 리모컨이있는 지점은 하나뿐입니다.
$ git branch -a
master
* no_upstream
remotes/origin/HEAD -> origin/master
remotes/origin/master
no_upstream
답 을 얻기 위해 어떤 명령을 실행할 수 있습니까?
실행할 git rev-parse --abbrev-ref --symbolic-full-name @{u}
수 있으며 리모컨이 없음을 보여줍니다.
$ git rev-parse --abbrev-ref --symbolic-full-name @{u}
error: No upstream configured for branch 'no_upstream'
error: No upstream configured for branch 'no_upstream'
fatal: ambiguous argument '@{u}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
그러나 이것은 오류이기 때문에 그것을 사용하거나 다른 명령으로 파이프 할 수 없습니다. 나는 이것을 쉘 스크립트 별칭으로 사용 git-delete-unbranched
하거나 아마도 매우 간단한 보석을 만들려고합니다.git-branch-delete-orphans