0 > 도표 (모르는 부분만 참고해주세요.) 옵션의 의미 기타 -m , –message 커밋 메시지 2번 항목 참조 – aor –all 2번 항목 참조 – por –patch 선택하여 추가 가능합니다.3번 항목 참조–amend 현재 브랜치 마지막 커밋 교환 4번 항목 참조–author author 이름 변경시 5번 항목 참조
1 > Manual page

2> git commit -a -m-a:untr acked file을 제외하고 tracking 파일 중 수정한 파일 전부를 staing area(index)에 추가합니다.



위의 status정보를 보시면 working directory에 d.txt가 수정이 된 상태입니다.
그 후 아래와 같이 commit을 실행한 후 $gitcommit-a-m”modified d.txt”$gitstatus

git add. txt 코드를 -a로 바꿉니다. (untracked file은 별도로 git add를 해야합니다.)
2-1 > 2줄 이상 commit 메시지 추가 >> -moption을 복수 사용하면 됩니다.git log 이미지를 첨부합니다.

2-2 > index 영역의 여러 파일 중 선택하여 Commit 하는

위와 같이 a.txt와 d.txt가 ind ex 영역에 있을 때, d.txt 파일만 commit하는 $gitcommit-m”add.txt”d.txt

git status에서 확인할 때 a.txt만 남아있는 게 보이면 OK

< Syntax > $ git commit – m ” commit message ” file 1 file 2 ……
3 > – p option

위 그림과 같이 modified형태로 p옵션을 사용가능합니다.
$ git commit – p – m ” modified commit _ 1 . txt “

git diff 한 내용이 떴다 y 누르면 commit가 되고 n을 누르면 취소가 됩니다 help는 ? index 영역에서는 commit은 가능한가 -p 옵션은 동작하지 않습니다.

- poption 후 help 화면

4 > — amendManual page


위 그림의 git log상태에서 아래 그림에 amend commit을 실행하면 $git commit –amend -m”add commit_amend.txt”

commitid가 마지막 버전이 사라지고 새로운 버전으로 update되었네요.마지막 commit상태에서 다른 commit을 만들지 않고 message나 파일을 추가할 때 사용하면 좋습니다.
<참고> git reflog를 사용하여 amend 이전 상태의 commit을 찾은 후 복귀할 수도 있습니다.
5 > — author
$ git commit — author = ” John Doe < [email protected] > ” – m ” commit comit _ 2 . txt with author “

$ git log 결과를 첨부합니다.

마지막 commit Author 부분 변경된 거 보이네요
< 기타 >
a > 출력문구 insertions, deletions의 의미를 이해한다

하나의 파일이 바뀌었다는 내용과 6라인 추가, 2라인 제거가 있었다고 적혀있습니다git show에서 확인해봤어요$ git show

–> 빨간색 제거된 부분은 2라인, 추가된 부분은 초록색 6라인