2013-05-03 4 views
7

BitBucket에서 git repo 포크를 만들었습니다 (fork_origin이라고합시다). 이제 업스트림 리포지토리 (upstream_origin이라고 함)에는 마스터로 병합 된 여러 분기가 있고 삭제되었습니다. 그래서 remote/upstream_origin/ 가지의업스트림에있는 Git repo에서 삭제되었지만 여전히 내 포크에있는 분기 가지 치기

git fetch --prune upstream_origin 

삭제를 많이 실행,하지만 지금은 그 같은 지점은 여전히 ​​remote/fork_origin/ 네임 스페이스에 존재한다.

이 문제를 해결하기위한 표준 git 명령이 있습니까? 원격 저장소에서 대량 삭제를 수행하는 복잡한 bash 스크립트를 사용하지 않기를 바랍니다.

는 UPDATE :

git remote prune fork_origin 

그러나, 그것은 영향을 미치지 아니합니다 :

제안으로

, 나는 원격 자두 명령을 사용하려고했습니다. 추가 조사되면, 그것은 단지 '부실'지점에 대해 작동하는 것 같다,하지만 난 실행하면

git remote show fork_origin 

이 가지 모두 여전히 '추적'을 보여준다. 따라서 git remote prune 명령에는 삭제할 오래된 것이 없습니다. 원격 저장소 (fork_origin)가 지점 상태를 upstream_origin에 상대적으로 업데이트하도록 강제 할 수 있습니까?

+0

혹시이 알아낼나요 :

git branch -a | grep origin | awk -F \/ '{print $NF}' > _my_branches.txt; git branch -a | grep upstream | awk -F \/ '{print $NF}' > _upstream_branches.txt; for deleted_branch_name in 'comm -23 _my_branches.txt _upstream_branches.txt'; do git push origin :$deleted_branch_name; done 

대신 하나 개의 긴 명령의 단계를 선호하는 경우

? 나는 같은 문제를 겪고있다 – BigBrownBear00

답변

1

원격 사용에서이 명령 가지를 제거하려면 :

git remote prune fork_origin 

하지만 그 전에

는,이 스레드를 살펴보고 잘못 될 수 있는지 :이 없습니다 git remote prune – didn't show as many pruned branches as I expected

+0

이 명령이 무엇을했는지에 관한 질문에 대한 업데이트를 추가했다. 또한 이들은 로컬 브랜치를 추적하지 않는 브랜치이므로 다른 스레드의 문제가 내 상황에 적용되지 않는다고 생각합니다. –

0

을 단일 자식 명령,하지만 당신이 필요합니다;

(때문에 당신의 git fetch --prune upstream_origin의) remotes/upstream_origin에 더 이상 존재하지 않는 어떤 remotes/fork_origin/branch를 식별 가져옵니다.

0

Linux 및 Mac 사용자의 경우이 명령은 업스트림에서 삭제 된 내 작업의 모든 브랜치를 삭제합니다.

# Find the branches in my fork 
git branch -a | grep origin | awk -F \/ '{print $NF}' > _my_branches.txt; 
# Find the branches still in upstream 
git branch -a | grep upstream | awk -F \/ '{print $NF}' > _upstream_branches.txt; 
# See only the ones that are still in my fork with the comm command 
# And only for those branches issue a git command to prunbe them from my fork. 
for deleted_branch_name in `comm -23 _my_branches.txt _upstream_branches.txt`; do git push origin :$deleted_branch_name; done 
관련 문제