반응형
전체 파일 대신 한 줄을 git-checkout 할 수 있습니까?
버전이 지정된 파일의 여러 줄을 수정 한 경우 명령 줄로 한 줄 의 변경 사항을 취소 할 수 있습니까?
다음을 사용하여 전체 파일에 대해 수행하는 것과 같습니다.
git checkout /path/to/file.extension
하지만 이렇게 말하면
git checkout /path/to/file.extension --line 10
이것이 가능한가?
을 사용 git checkout -p하여 각 덩어리를 개별적으로보고 체크 아웃할지 또는 그대로 둘지 결정할 수 있습니다 (더 좁히려면 선택적 경로 인수도 사용함 ).
Matt의 답변에 대해 자세히 설명하려면 git checkout --patch -- <path argument>다음 옵션을 사용하여 대화 형 모드를 시작합니다.
y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk or any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk or any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help
y n s및 e옵션은 시작하기에 좋은 장소입니다.
또한보십시오:
- https://git-scm.com/docs/git-checkout for
--patch - 대화 형 옵션은 https://git-scm.com/docs/git-add .
반응형
'Program Club' 카테고리의 다른 글
| Django와 ReactJS-실제 사용 (0) | 2020.10.19 |
|---|---|
| Javascript의 sort ()는 어떻게 작동합니까? (0) | 2020.10.19 |
| 변수가 null인지 빈 문자열인지 또는 JavaScript에서 모두 공백인지 확인하는 방법은 무엇입니까? (0) | 2020.10.18 |
| Linq의 Union Vs Concat (0) | 2020.10.18 |
| 사용자 지정 유효성 검사 angularjs 지시문을 테스트하려면 (0) | 2020.10.18 |