Bitbucket에서 분기 삭제
리포지토리 중 하나에 많은 지점을 만들었습니다. 이 지점들은 마스터에게 가져 오기 전에 테스트를위한 것입니다. 이제는 목록에 많은 것들이 표시되며 다시는 사용하지 않을 것입니다. 해당 지점을 Bitbucket으로 직접 삭제하는 방법은 무엇입니까?
분기가 로컬에만있는 경우 분기가 병합 된 경우 -d 를 사용할 수 있습니다.
git branch -d branch-name
분기에 병합 할 계획이없는 코드가 있으면 대신 -D를 사용하십시오.
지점이 업스트림 리포지토리 (Bitbucket)에 있으면 다음을 통해 원격 참조를 제거 할 수 있습니다.
git push origin :branch-name
또한 Bitbucket 웹 사이트 에있는 경우 사이트의 커밋 아래 에있는 기능 분기 탭 으로 이동하여 푸시 한 분기를 제거 할 수 있습니다. 줄임표 아이콘이 있습니다. 클릭 한 다음 분기 삭제 를 선택하십시오 . 모든 변경 사항을 삭제하십시오.
Bitbucket에서 지점을 삭제하려면
- 개요로 이동 (저장소> 왼쪽 사이드 바 지점 )
- 지점 수를 클릭하십시오 (분지 목록이 표시되어야 함).
- 삭제할 지점을 클릭하십시오
- 오른쪽 상단에서 3 개의 점 (병합 버튼 옆)을 클릭하십시오.
- 권한이있는 경우 "지점 삭제"옵션이 있습니다.
@Marcus가 제공 한 답변 외에도 이제 다음을 통해 원격 지점을 삭제할 수 있습니다.
git push [remote-name] --delete [branch-name]
에서 의 Bitbucket 왼쪽 메뉴에 지사로 이동합니다.
- 삭제할 지점을 선택하십시오.
- 작업 열로 이동하여 세 개의 점 (...)을 클릭하고 삭제를 선택하십시오.
나는 대부분의 분기를 삭제할 수 있지만 하나는 다음과 같으며 삭제할 수 없습니다.
밝혀졌다 누군가가 설정 한 Branch permissions
에서 Settings
거기되지 않은에서 Allow deleting this branch
. 이것이 누군가를 도울 수 있기를 바랍니다.
업데이트 : 코멘트에서 설정이있는 곳. 메뉴를 얻기 위해 편집하지 않을 저장소를 입력하십시오. 이를 변경하려면 관리자 권한이 필요할 수 있습니다.
1 단계 : Bitbucket에 로그인
2 단계 : 리포지토리 목록에서 리포지토리를 선택합니다.
4 단계 : 지점의 커서 포인트에서 3 개의 점을 클릭합니다 (...) 삭제 선택 (벨로우즈 이미지 참조)
If you are using a pycharm IDE for development and you already have added Git with it. you can directly delete remote branch from pycharm. From toolbar VCS-->Git-->Branches-->Select branch-->and Delete. It will delete it from remote git server.
I've wrote this small script when the number of branches in my repo exceeded several hundreds. I did not know about the other methods (with CLI) so I decided to automate it with selenium. It simply opens Bitbucket website, goes to Branches, scrolls down the page to the end and clicks on every branch options menu -> clicks Delete button -> clicks Yes. It can be tuned to keep the last N (100 - default) branches and skip branches with specific names (master, develop - default, could be more). If this fits for you, you can try that way.
https://github.com/globad/remove-old-branches
All you need is to clone the repository, download the proper version of Chrome-webdriver, input few constants like URL to your repository and run the script.
The code is simple enough to understand. If you have any questions, write comments / create an Issue.
In Android Studio, the options down the right corner of the IDE:
- Change/checkout other local branch
- Delete unwanted local branches (i.e. v0.0.1...)
- Delete unwanted remote branches (i.e. origin/v0.0.1...) -- this step will delete branches in BitBucket if the branches are not prevented to be deleted and they are not the MAIN BRANCH.
Try this command, it will purge all branches that have been merged to the develop
branch.
for i in `git branch -r --merged origin/develop| grep origin | grep -v '>' \
| grep -v master | grep -v develop | sed -E "s|^ *origin/||g"`; \
do \
git push origin $i --delete; \
done
If you like fun, then you can just go to the listing page of you branches (for example merged) and just run in the javascript console:
document.querySelectorAll('tr td div a:first-child').forEach(function(item) { fetch('https://bitbucket.org/snippets/new?owner=<yourprofilenick>', {'credentials': 'same-origin'}).then((response) => {return response.text()}).then(function(string) { return /'csrfmiddlewaretoken' value='(.*)'/g.exec(string)[1] }).then(function(csrf) { if (!~item.innerText.indexOf('/')) return;
fetch(`https://bitbucket.org/!api/2.0/repositories/<your_organization_path>/refs/branches/${item.innerText}`, {headers: {"x-csrftoken": csrf}, credentials: "same-origin", method: 'DELETE'}).then(() => console.log(`${item.innerText} DELETED!`)) }) })
BEFORE RUN
- replace
<yourprofilenick>
with your BitBucket nick - replace
<your_organization_path>
with your organization path
HOW IT WORKS
First we need a page with with a CSRF token in the page source, so I choose:
https://bitbucket.org/snippets/new?owner=<yourprofilenick>
Then for each branch (in a branch listing) it gets CSRF token and deletes that branch.
BEWARE
Remeber to prevent sensitive branches before deleting in repo settings.
It WON'T delete the main branch.
ADDITIONAL INFO
You have to be logged in.
It deletes only branches visible on that page (so to delete the rest of branches you have to go to the next page).
참고URL : https://stackoverflow.com/questions/15150671/delete-branches-in-bitbucket
'development' 카테고리의 다른 글
PHP set_time_limit ()를 사용하여 nginx 504 게이트웨이 시간 초과 방지 (0) | 2020.08.03 |
---|---|
jQuery : 클래스 및 입력 유형별로 선택 (0) | 2020.08.03 |
int를 varchar로 캐스트 (0) | 2020.08.03 |
three.js 배경을 투명 또는 다른 색으로 변경 (0) | 2020.08.03 |
10 미만의 int 값은 문자열 두 자리 숫자로 변환 (0) | 2020.08.03 |