728x90
https://git-scm.com/docs/git-add
파일에 여러 개 기능이 구현되어 있는 경우
하나의 파일에 여러 개 기능이 구현된 경우, 어떻게 기능 단위로 add 할 수 있는가?
git add -p <filename>
위 명령어로 파일 내에서 변경된 내용을 쪼개서 추가할 수 있다.

README.md에서 A, B, C가 추가된걸 확인할 수 있다.
--patch, -p
이 옵션은 변경된 파일에서 변경된 부분을 라인별로 선택해서 `add` 할 수 있는 옵션이다.
add 할지 말지는 콘솔에서 대화형으로 선택할 수 있는데, 아래와 같은 타입이 있다.
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
p - print the current hunk
? - print help
프로젝트에서 `y`, `n`, `s`만 사용했다.
`y`: 해당 hunk를 stage에 추가한다.
`n`: 해당 hunk를 stage에 추가하지 않는다.
`s`: 해당 hunk를 더 작게 쪼갠다.
실습한 예시는 아래 사진과 같다.

728x90
'ASAC 웹 풀스택' 카테고리의 다른 글
Java 기본 문법 및 JVM 구성(4) - JVM (0) | 2024.09.28 |
---|---|
Java 기본 문법 및 JVM 구성(3) - ⭐️Exception 예외 처리 (3) | 2024.09.27 |
Java 기본 문법 및 JVM 구성(2) - 자바 개발 환경 설정(Intellij, Gradle, Lombok) (2) | 2024.09.25 |
Java 기본 문법 및 JVM 구성(1) - Java동작 원리 (0) | 2024.09.25 |
React 의 특장점, 렌더 라이프사이클 및 Hook(7) - immer(리렌더링 이슈 해결) (1) | 2024.09.22 |
728x90
https://git-scm.com/docs/git-add
파일에 여러 개 기능이 구현되어 있는 경우
하나의 파일에 여러 개 기능이 구현된 경우, 어떻게 기능 단위로 add 할 수 있는가?
git add -p <filename>
위 명령어로 파일 내에서 변경된 내용을 쪼개서 추가할 수 있다.

README.md에서 A, B, C가 추가된걸 확인할 수 있다.
--patch, -p
이 옵션은 변경된 파일에서 변경된 부분을 라인별로 선택해서 add
할 수 있는 옵션이다.
add 할지 말지는 콘솔에서 대화형으로 선택할 수 있는데, 아래와 같은 타입이 있다.
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
p - print the current hunk
? - print help
프로젝트에서 y
, n
, s
만 사용했다.
y
: 해당 hunk를 stage에 추가한다.
n
: 해당 hunk를 stage에 추가하지 않는다.
s
: 해당 hunk를 더 작게 쪼갠다.
실습한 예시는 아래 사진과 같다.

728x90
'ASAC 웹 풀스택' 카테고리의 다른 글
Java 기본 문법 및 JVM 구성(4) - JVM (0) | 2024.09.28 |
---|---|
Java 기본 문법 및 JVM 구성(3) - ⭐️Exception 예외 처리 (3) | 2024.09.27 |
Java 기본 문법 및 JVM 구성(2) - 자바 개발 환경 설정(Intellij, Gradle, Lombok) (2) | 2024.09.25 |
Java 기본 문법 및 JVM 구성(1) - Java동작 원리 (0) | 2024.09.25 |
React 의 특장점, 렌더 라이프사이클 및 Hook(7) - immer(리렌더링 이슈 해결) (1) | 2024.09.22 |