2013-03-20 3 views
30

다른 브랜치에있는 다른 버전의 파일을 현재 브랜치에로드하려고합니다.git : 다른 브랜치에서 현재 브랜치로 파일 체크 아웃 (머리글을 다른 브랜치로 전환하지 않음)

git help checkout는 말한다 :

DESCRIPTION 
    Updates files in the working tree to match the version in the index or 
    the specified tree. If no paths are given, git checkout will also 
    update HEAD to set the specified branch as the current branch. 

모든 파일을 체크 아웃 할 수있는 방법이 있나요하지만 하지 업데이트 HEAD? 전류 경로를 제공함으로써

답변

37

결제, . :

git checkout other-branch-name -- .

이 조작 switching HEAD to another branch without checking out files 유사하지만, 단지 "반대 방향"에서.

@ 김민준이 언급하기 때문에, 이것은 커밋되지 않은 변경 사항을 덮어 씁니다. 필요할 경우 숨기거나 어딘가에 보관하십시오.

+2

머리를 위로하면 모든 커밋되지 않은 작업이 삭제됩니다. 뒤늦은 지경에도 불구하고 힘들어했다. '( –

관련 문제