13.2.3 파일 수정하기

    파일을 수정해 봅시다. 출력 재지정 기호 >>를 써서 echo 명령의 문자열을 파일에 덧붙입니다.

    administrator@vmgate:~/gittest$ echo 'l live so lm meaningless.' >> failure.txt

    git status로 확인해 보니 파일이 변경(modified)되었습니다.

    administrator@vmgate:~/gittest$ git status
    On branch master
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
        modified:   failure.txt
    
    no changes added to commit (use "git add" and/or "git commit -a")

    git add 명령으로 파일을 준비 영역으로 추가합니다.

    administrator@vmgate:~/gittest$ git add failure.txt
    administrator@vmgate:~/gittest$ git status
    On branch master
    Changes to be committed:
      (use "git restore --staged <file>..." to unstage)
        modified:   failure.txt

    git commit 명령으로 파일을 커밋합니다. 커밋에 성공했으며 작업 디렉터리, 준비 영역 모두 깨끗이 비워진 상태입니다.

    administrator@vmgate:~/gittest$ git commit -m 'Edit failure.txt'
    [master 5aba677] Edited failure.txt
     1 file changed, 1 insertion(+)
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.