다른 분기의 커밋된 복사본이 있는 파일의 현재 작업 복사본
파일이 있는 레포가 있습니다.foo본지점에서저는 바 지점으로 전환하여 몇 가지 변경 사항을 적용했습니다.foo이제 어떻게 실행할 수 있습니까?git diff이 복사본(아직 커밋되지 않음)과 마스터 브랜치 복사본 사이에 있습니까?
다음은 저에게 적합합니다.
git diff master:foo foo
과거에는 다음과 같은 경우가 있었습니다.
git diff foo master:foo
작업 트리를 특정 지점 이름과 비교하려고 하므로 다음과 같은 작업을 수행할 수 있습니다.
git diff master -- foo
이 git-diff 형식에서 나온 것입니다(git-diff 맨 페이지 참조).
git diff [--options] <commit> [--] [<path>...]
This form is to view the changes you have in your working tree
relative to the named <commit>. You can use HEAD to compare it with
the latest commit, or a branch name to compare with the tip of a
different branch.
참고로, 또한 있습니다.--cached(일명)--staged작업 트리의 모든 항목이 아닌 준비한 항목의 차이를 보는 옵션:
git diff [--options] --cached [<commit>] [--] [<path>...]
This form is to view the changes you staged for the next commit
relative to the named <commit>.
...
--staged is a synonym of --cached.
git difftool tag/branch filename
또한:git diff master..feature foo
부터git diff foo master:foo저는 디렉토리에서 작동하지 않습니다.
git diff mybranch master -- file
또한 작동해야 합니다.
효과적인 기능:
git diff master ./relative-path-to-foo
현재 분기와 비교하여 로컬 변경 내용을 보려면 다음과 같이 하십시오.
git diff .
다른 기존 분기와 비교하여 로컬 변경 내용을 보려면 다음과 같이 하십시오.
git diff <branch-name> .
특정 파일의 변경 내용을 보려면 다음과 같이 하십시오.
git diff <branch-name> -- <file-path>
실행해야 합니다.git fetch처음에
이름이 붙은 지점이 있다고 가정해 보겠습니다.master그리고라는 이름의 가지.feature그리고 당신은 특정한 파일을 확인하고 싶습니다.my_file그러면:
git diff master..feature /Path/to/my_file의 커밋된 버전 간의 차이를 보여줍니다.my_file분기하여master그리고.feature.git diff master -- /Path/to/my_file작업 디렉토리(미사용 파일)와 분기 간의 차이를 보여줍니다.master의my_file.
언급URL : https://stackoverflow.com/questions/9113280/diff-current-working-copy-of-a-file-with-another-branchs-committed-copy
'programing' 카테고리의 다른 글
| 비트별 그룹 기능을 수행할 수 있습니까? (0) | 2023.07.06 |
|---|---|
| Typescript를 사용하여 재료 UI 구성 요소의 소품을 확장하는 방법은 무엇입니까? (0) | 2023.07.06 |
| newidsql server 함수 내부 (0) | 2023.07.06 |
| IN() 절 oracle PLSQL의 배열 (0) | 2023.07.06 |
| 파이썬을 사용하여 암호로 보호된 엑셀 파일을 여는 방법은 무엇입니까? (0) | 2023.07.01 |