IT

git remote update와 fetch의 차이점은 무엇입니까?

lottoking 2020. 5. 24. 11:14
반응형

git remote update와 fetch의 차이점은 무엇입니까?


? git remote update에 해당 git fetch합니까?


업데이트 : 추가 정보!

처음부터이 작업을 수행해야했습니다. Git 릴리스 노트를 Git 's Git repo (그래서 메타!)에 정리했습니다.

grep --color=always -R -C30 fetch Documentation/RelNotes/* | less

그런 다음에 대한 less검색을 수행 --all했으며 이것이 Git 버전 1.6.6릴리스 정보에서 찾은 것입니다 .

git fetch배운 --all--multiple옵션은 여러 저장소에서 가져 오기를 실행하고, --prune옵션은 오래된 갔다 원격 추적 지점을 제거 할 수 있습니다. 이 메이크업 git remote updategit remote prune덜 필요 (제거 할 계획이없는 remote updateremote prune불구하고).

버전 1.6.6은 2009 년 12 월 23 일 까지 출시되지 않았 으며 Original Poster는 2009 년 12 월 6 일에 질문을했습니다.

릴리스 노트에서 알 수 있듯이 Git 작성자는 git remote update명령 기능이 약간 복제 되었다는 사실을 알고 git fetch있었지만이를 제거하지 않기로 결정했습니다. 기존 스크립트 및 프로그램과의 호환성을 위해 또는 아마도 너무 많은 작업이며 우선 순위가 높은 항목이 있습니다.


자세한 내용이 포함 된 원본 답변

xenoterracide의 대답은 3.5 세이며, 힘내 (이 사라 졌 그 이후로 여러 버전을 통해 간 v1.6.5.5 이 글을 쓰는 현재의 v1.8.3.2로) 및보고 현재 에 대한 문서 git remote updategit fetch보이는, 같은 그들 모두는 기본적으로 여러 개의 리모컨의 새로운 커밋을 가져 오는 동일한 기능을 수행 할 수 있는 권리 옵션 및 인수 주어진.

모든 리모컨을 가져 오는 중

여러 리모트를 페치하는 한 가지 방법은 다음 --all플래그를 사용하는 것 입니다.

git fetch --all

remote.<name>.skipFetchAll설정 하지 않은 것으로 가정하면 구성된 모든 원격에서 가져옵니다 .

true 인 경우 git-fetch (1) 또는 git-remote (1) 의 update 하위 명령을 사용하여 업데이트 할 때이 원격은 기본적으로 건너 뜁니다 . git-config 문서

이것은 사용하는 것과 같습니다.

git remote update

가져올 원격 그룹을 지정하지 않고 remotes.defaultrepo 구성에서 설정 하지 않았으며 어떤 원격 remote.<name>.skipDefaultUpdatetrue로 설정 하지 않았습니다 .

망할 놈의 구성에 대한 현재 1.8.3.2 문서는 언급하지 않는 remotes.default설정을,하지만 난 그것에 대해 전능 구글 상담과에서이 도움이 설명 발견 Mislav Marohnić를 :

$ git config remotes.default 'origin mislav staging'
$ git remote update

# fetches remotes "origin", "mislav", and "staging"

remote update명령에 의해 페치 될 기본 리모트 목록을 정의 할 수 있습니다 . 이들은 팀원, 오픈 소스 프로젝트의 신뢰할 수있는 커뮤니티 구성원 또는 이와 유사한 원격 사용자 일 수 있습니다.

따라서 remotes.default설정 한 경우 일부 리모콘이 나열되어 git remote update있지 않으면 리포지토리가 "인식"한 모든 리모콘을 가져 오지 않습니다.

에 관해서는 remote.<name>.skipDefaultUpdate설정, 힘내 문서는 thusly 히 그것을 설명 :

true 인 경우 git-fetch (1) 또는 git-remote (1) 의 update 하위 명령을 사용하여 업데이트 할 때이 원격은 기본적으로 건너 뜁니다 .

지정된 리모트 그룹 가져 오기

대신 모든 리모컨을 가져 오는 중, 모두 fetchremote update여러 리모트 및 가져올 리모컨의 그룹을 지정할 수 있습니다 :

git fetch [<options>] <group>
git fetch --multiple [<options>] [(<repository> | <group>)…]

git fetch [<options>] <group>그룹의 일부인 여러 리모컨을 가져올 수 있습니다 ( Mislav 에서 다른 예제를 빌리기 위해 ).

$ git config remotes.mygroup 'remote1 remote2 ...'
$ git fetch mygroup

git fetch --multiple여러 저장소 및 저장소 그룹을 지정하여 한 번에 가져올 수 있습니다 ( docs에서 ).

할 수있는 몇 가지 <repository><group>인수를 지정할 수 있습니다. 없음이 <refspec>s지정되지 않을 수 있습니다.

git remote update문서의 모호성

개요git remote update 는 명령 구문이 다음과 같음 지정합니다.

git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)…]

마지막 부분 인 [(<group> | <remote>)…]? 후행 점 ...은 명령을 사용하여 여러 그룹과 리모컨을 지정할 수 있음을 의미합니다. 이것은 동일한 방식으로 작동한다는 것을 의미합니다 git fetch --multiple... 두 가지 구문이 어떻게 비슷한 지보십시오?

그러나 동일한 문서에서 update명령에 대한 설명은 여러 그룹 및 원격 인수를 지정하는 것에 대해 아무 것도 말하지 않습니다.

에서 정의한대로 리포지토리의 명명 된 원격 세트에 대한 업데이트를 가져옵니다 remotes.<group>.

따라서 여러 개의 개별 리모컨과 여러 개의 원격 그룹을 지정하는 git remote update것과 동일하게 작동하는지 확실하지 않습니다 git fetch --multiple.

단일 리모컨 가져 오기

마지막으로, 모든 사람은 단일 리모컨을 가져 오는 간단한 경우를 알고 있습니다.

git fetch <remote>

당신은 또한 사용할 수있는 경우가 있습니다

git remote update <remote>

이전 섹션에서 언급했듯이 명령을 사용하여 git remote update단일 원격 그룹 그룹 이외의 것을 가져올 수 있는지 여부는 확실하지 않습니다 .

마무리

As I've explained, git fetch and git remote update behave similarly with regard to fetching from multiple remotes. They share similar syntax and arguments, though git fetch is shorter, so people probably find it easier to type and use.

It may be the case that git remote update can't be used to fetch just a single remote like with git fetch, but as I've pointed out, the documentation doesn't make this clear.

Aside

The duplication in functionality between Git porcelain commands, exemplified by git fetch and git remote update above, is not unique. I've noticed a similar situation with git rebase --onto and git cherry-pick, in that both can take a range of commits to patch onto a new base commit.

I guess that as Git has evolved over the years, some functionality was (inevitably?) duplicated, perhaps sometimes as a convenience for end-users (for example, it's simpler to pass a range to cherry-pick, than to pass a single commit over and over to pick a range). Apparently cherry-pick didn't always accept a range of commits, as explained in the v1.7.2 release notes:

git cherry-pick learned to pick a range of commits (e.g. cherry-pick A..B and cherry-pick --stdin), so did git revert; these do not support the nicer sequencing control rebase [-i] has, though.


Yes and no. git remote update fetches from all remotes, not just one.

Without looking at the code to see if remote update is just a shell script (possible) it, basically, runs fetch for each remote. git fetch can be much more granular.

참고 URL : https://stackoverflow.com/questions/1856499/differences-between-git-remote-update-and-fetch

반응형