Git의 리모트 브랜치 추적을 중지하려면 어떻게 해야 합니까?
Git의 리모트 브랜치 추적을 중지하려면 어떻게 해야 합니까?
제 경우 리모트 브랜치가 아닌 로컬 브랜치를 삭제하고 싶기 때문에 트래킹을 중지해 주십시오.로컬을 삭제하고 삭제를 리모트로 푸시하면 리모트브런치도 삭제됩니다.
냥 can 하 、 면 、 can 、 can 、 can 、 can 、 can 、 。git branch -d the_branch
에 제가 git push
무슨 일입니까?
git push origin :the_branch
★★★★★★★★★★★★★★★★★?
Yoshua Wuyts의 답변에서 언급된 바와 같이 다음을 사용합니다.
git branch --unset-upstream
기타 옵션:
로컬 브랜치를 삭제할 필요가 없습니다.
리모트 브랜치를 추적하고 있는 로컬브런치를 삭제하기만 하면 됩니다.
git branch -d -r origin/<remote branch name>
-r, --remotes
는 git에게 리모트브런치를 삭제하도록 지시합니다(즉, 리모트브런치를 추적하기 위해 브랜치세트를 삭제합니다).리모트 리포트상의 브랜치는 삭제되지 않습니다.
git-fetch를 이해하는 데 어려움이 있다를 참조하십시오.
로컬 트래킹 브랜치라는 개념은 없고 리모트 트래킹 브랜치만 있습니다.
★★★★★★★★★★★★★★★★★.origin/master
、 の の の branchmaster
origin
Dobes Vandermeer의 답변에서 설명한 바와 같이 로컬브런치에 관련된 설정도 리셋해야 합니다.
git config --unset branch.<branch>.remote
git config --unset branch.<branch>.merge
합니다.
<branchname>
.
분기를 지정하지 않으면 현재 분기로 기본 설정됩니다.
(git 1.8+, 2012년 10월 카를로스 마르틴 니에토 ()carlosmn
의 b84869e 커밋)
푸시/ 못하게 .origin/<remote branch name>
.
현재 브랜치의 업스트림을 삭제하려면 다음 절차를 수행합니다.
$ git branch --unset-upstream
이것은 Git v.1.8.0 이후부터 이용 가능합니다.(출처: 1.7.9 ref, 1.8.0 ref)
로컬 브랜치 실행과 리모트브런치 실행의 관련성을 삭제하려면 , 다음의 순서에 따릅니다.
git config --unset branch.<local-branch-name>.remote
git config --unset branch.<local-branch-name>.merge
필요에 따라 나중에 로컬브런치를 삭제합니다.
git branch -d <branch>
리모트 브랜치는 삭제되지 않습니다.
은 편집하는 입니다..git/config
여기 샘플 파일이 있습니다.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
url = git@example.com:repo-name
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "test1"]
remote = origin
merge = refs/heads/test1
[branch "master"]
remote = origin
merge = refs/heads/master
을 합니다.merge = refs/heads/test1
test1
리모트 트래킹브런치를 삭제하려면
git branch -d -r origin/<remote branch name>
VonC von von 。하고 있는 는, 「」, 「」를 참조해 주세요.git push
는, 그 브랜치를 계속 푸시 하려고 합니다(이것은, 러핀의 경우와 같이, 고속 전송 에러가 아닌 에러가 발생할 가능성이 있습니다).그 이유는,push.default
로는 '''로 되어 있습니다.matching
'먹다, 먹다, 먹다'라는 뜻입니다.
matching - 일치하는 모든 분기를 푸시합니다.양쪽 끝에 같은 이름을 가진 브랜치는 모두 일치하는 것으로 간주됩니다.이것이 기본값입니다.
( http://git-scm.com/docs/git-config 를 참조해 주세요.push.default
)
했을 때 이 아닐 , 「」, 「」, 「」를 설정할 수 .push.default
로로 합니다.upstream
(오류)tracking
1 . . . 3) <가
upstream - 현재 브런치를 업스트림브런치에 푸시합니다.
사용.
git config push.default upstream
그리고 git은 당신이 "추적"을 하고 있는 브랜치를 푸시하는 것을 중지합니다.
주의: 간단한 해결책은 로컬 지점의 이름을 다른 이름으로 바꾸는 것입니다.그러면 혼란의 가능성도 없어집니다.
로컬 트래킹브런치
(★★★★★★★★★★★★★)main
,dev
)로되어 있습니다.push
- 및 - ★pull
업스트림[리모트브런치]에서, 다음의 조작으로 디세블로 할 수 있습니다.
❯ git branch --unset-upstream <LOCALBRANCH>
예:
❯ git branch --unset-upstream dev
❯ git branch --unset-upstream feature-x
리모트 트래킹브런치
지사를 <REMOTE>/<BRANCH>
origin/main
,origin/dev
것들이 많이 나오죠.git log
(그리고).git/refs/remotes/<REMOTE>/
directory는 리모트브런치 현재 directory로 리모트브런치 를 「 않게 할수 있습니다.이 경우 보유 중인 리모트브런치 목록을 자신의 새로운 커스텀리스트로 덮어쓰면 리모트브런치 상태를 「갱신」(갱신)하지 않게 할 수 있습니다.
❯ git remote set-branches <REMOTE> [<REMOTE-BRANCH> …]
를 더 않은,git log
(그리고).git/refs/remotes/<REMOTE>/
를 사용하여 할 수
❯ git branch --delete --remotes -- <REMOTE>/<BRANCH>
Deleted remote-tracking branch <REMOTE>/<BRANCH> (was 1f1a655).
예:
# keep tracking `origin/main`, and `origin/dev`,
# untrack all other `origin/*` remote branches
❯ git remote set-branches origin main dev
# delete remote branches previously tracked, from the
# `.git/refs/remotes/<REMOTE>/` directory
❯ git branch --delete --remotes -- origin/feature-x origin/feature-y
❯ git branch --delete --remotes -- origin/hotfix-z
오래된 리모트브런치
마지막으로 리모트저장소 자체에서 삭제된(오래된) 리모트브런치가 있으며 이를 반영하여 로컬저장소를 갱신하는 경우에는 그것들을 삭제(프루닝)하여 다음과 같이 할 수 있습니다.
# automatically
❯ git remote prune <REMOTE>
Pruning <REMOTE>
URL: <REMOTEURL>
* [pruned] <REMOTE>/<BRANCH>
...또는
# manually
❯ git branch --delete --remotes -- <REMOTE>/<BRANCH>
Deleted remote-tracking branch <REMOTE>/<BRANCH> (was 1f1a655).
PS
추적 상태는 다음 방법으로 확인할 수 있습니다.
❯ git remote show <REMOTE>
예:
❯ git remote show origin
* remote origin
Fetch URL: /Users/johndoe/bare-remote
Push URL: /Users/johndoe/bare-remote
HEAD branch: ant
Remote branches:
brooms tracked
bull tracked
cat tracked
deer tracked
dog tracked
foxy tracked
john tracked
master tracked
new tracked
tim tracked
timothy tracked
Local branches configured for 'git pull':
ant merges with remote ant
master merges with remote master
Local refs configured for 'git push':
ant pushes to ant (up to date)
master pushes to master (up to date)
git-remote(1):
set-branches
: 이름 있는 리모트로 트래킹되는 브랜치목록을 변경합니다.이것은, 리모트의 초기 설정 후에 사용 가능한 리모트 브랜치의 서브셋을 추적하기 위해서 사용할 수 있습니다.
prune
와 참조를 추적 구성과 할 수도 와 관련된 오래된 참조를 삭제합니다.기본적으로 오래된 리모트 트래킹브런치는 삭제되지만 글로벌 설정 및 리모트 설정에 따라서는 푸시되지 않은 로컬태그를 삭제할 수도 있습니다.
show
에 대한 : 리리 : : : 。git-filename(1):
--unset-upstream
에를 삭제합니다
--delete
합니다.: 브랜치를 삭제합니다.
--remotes
또는 사용하는 리모트 트래킹브런치를 리스트 또는 삭제합니다(-d와 함께 사용하는 경우).
다음은 패턴에 일치하는 모든 원격 추적 분기를 제거하는 한 줄입니다.
git branch -rd $(git branch -a | grep '{pattern}' | cut -d'/' -f2-10 | xargs)
질문에 대한 답변은 아니지만, 위의 댓글에서 적절한 코드 포맷을 얻는 방법을 찾을 수 없었습니다.평판 자동 하락, 평판 자동 하락, 제 코멘트는 이렇습니다.
@Dobes가 제출한 레시피가 내 .gitconfig에 화려한 shmany [alias]엔트리에 있습니다.
# to untrack a local branch when I can't remember 'git config --unset'
cbr = "!f(){ git symbolic-ref -q HEAD 2>/dev/null | sed -e 's|refs/heads/||'; }; f"
bruntrack = "!f(){ br=${1:-`git cbr`}; \
rm=`git config --get branch.$br.remote`; \
tr=`git config --get branch.$br.merge`; \
[ $rm:$tr = : ] && echo \"# untrack: not a tracking branch: $br\" && return 1; \
git config --unset branch.$br.remote; git config --unset branch.$br.merge; \
echo \"# untrack: branch $br no longer tracking $rm:$tr\"; return 0; }; f"
그럼 그냥 뛰어가면 되겠네
$ git bruntrack branchname
가장 쉬운 방법은 원격으로 지점을 삭제한 후 다음을 사용하는 것입니다.
git fetch --prune (일명 git fetch -p)
git branch --unset-upstream
는 모든 로컬브런치의 추적을 정지합니다.이것은 바람직하지 않습니다.
를제 remove remove remove를 remove remove 를 remove 。[branch "branch-name"]
의 .git/config
에 "file"이 계속됩니다.
git branch -D 'branch-name' && git branch -D -r 'origin/branch-name'
저한테는 가장 잘 맞는 것 같아요.
이 방법을 사용하여 원격 분기를 제거할 수 있습니다.
git remote remove <your remote branch name>
언급URL : https://stackoverflow.com/questions/3046436/how-do-you-stop-tracking-a-remote-branch-in-git
'programing' 카테고리의 다른 글
WPF의 Windows 7 테마 (0) | 2023.04.12 |
---|---|
Postgresql에서 두 열의 조합에 대해 고유한 강제 적용 (0) | 2023.04.12 |
Array Excel VBA 요소의 반환 색인 (0) | 2023.04.12 |
Xcode 4는 타겟 디바이스에서 "finished running"이라고 표시되며, 아무 일도 일어나지 않습니다. (0) | 2023.04.12 |
WPF 앱이 창을 닫으면 포커스가 완전히 흐트러진다. (0) | 2023.04.12 |