Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git 사용 방법
  6. Git에서 기록을 관리하는 방법
  7. 커밋 수정
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

커밋 수정

방금다운로드한 git-tutorial/tutorial1 디렉터리로 이동합니다.

이 저장소의 기록을 검토하면 다음과 같이 표시됩니다.

The history of repository

저장소 기록을 확인하기 위해 git log 명령을 사용하면 다음과 같이 표시됩니다.

$ git log
commit f01c8c09f09e14063feb13b24be592e507ea365b (HEAD -> main)
Author: yourname <yourname@yourmail.com>
Date:   Mon Jul 16 23:17:56 2012 +0900
    EDITED: append description of the add command
commit 0de54de5d846d5fb800cf0f4d74f0c79d2e0a186
Author: yourname <yourname@yourmail.com>
Date:   Mon Jul 16 23:16:14 2012 +0900
    first commit

기록 로그의 첫 번째 커밋을 다시 작성해 보겠습니다.

먼저 sample.txt 파일을 열고 아래 굵은 텍스트를 추가합니다.

Anyone can learn Git with this tutorial and Backlog add: Register a change in an index commit: Save the status of an index

--amend 옵션을 사용하여 커밋합니다.

$ git add sample.txt
$ git commit --amend

편집할 수 있는 최신 커밋 메시지가 포함된 기본 편집기가 열립니다. 이 자습서에서는 메시지를 "Add direction of the Add and the Commit"으로 변경한 다음 텍스트 편집기를 저장하고 종료합니다.

이제 커밋 메시지가 업데이트되었습니다. log 명령을 다시 사용하여 저장소 기록과 새 커밋 메시지가 다음과 같은지 확인합니다.

the result of "commit --amend"
$ git log
commit e9d75a02e62814541ee0410d9c1d1bf47ab1c057
Author: yourname
Date:   Mon Jul 16 23:17:56 2022 +0900

    Add direction of the Add and the Commit

commit 48eec1ddf73a7fb508ef664efd6b3d873631742f
Author: yourname
  Date:   Mon Jul 16 23:16:14 2022 +0900

      first commit

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life