Notice
Recent Posts
Recent Comments
Link
관리 메뉴

데브마우스

[Git:명령어 정리] commit 명령어 정리 본문

Git/Git: 명령어 정리

[Git:명령어 정리] commit 명령어 정리

데브마우스 2024. 1. 9. 20:44

git commit 명령어 정리

git commit은 git add 명령어로 추가한 파일 혹은 폴더를 스테이지에 올릴 때 사용하는 명령어입니다. 

git commit 형식

git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]
           [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|reword):]<commit>)]
           [-F <file> | -m <msg>] [--reset-author] [--allow-empty]
           [--allow-empty-message] [--no-verify] [-e] [--author=<author>]
           [--date=<date>] [--cleanup=<mode>] [--[no-]status]
           [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]
           [(--trailer <token>[(=|:)<value>])…​] [-S[<keyid>]]
           [--] [<pathspec>…​]

방금 커밋한 메시지를 수정하는 명령어: git commit --amend

git commit --amend

위 명령문으로 방금 커밋한 메시지를 수정할 수 있습니다.

Git Bash에서 위 명령어를 입력할 경우 vim 편집기로 전환되며 커밋 메시지를 입력합니다. 이후 :wq 명령어로 빠져나올 수 있습니다. 커밋해시가 변경되며 방금 입력한 메시지는 사라지며 방금 입력한 메시지를 git log로 확인하실 수 있습니다.