가장 최근 커밋 1개

git commit —amend

 

수정대상 커밋 여러개

git rebase -i HEAD~n

 

rebase는 squash만 썼는데 커맨드를 보니 다양한 기능이 있었다.

내가 필요했던 기능은 fixup이었음 ㅋㅋ docs를 잘 읽자

 

# Rebase xxxxxxx..yyyyyyy onto zzzzzzz (1 command)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
#                    commit's log message, unless -C is used, in which case
#                    keep only this commit's message; -c is same as -C but
#                    opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# .       create a merge commit using the original merge commit's
# .       message (or the oneline, if no original merge commit was
# .       specified); use -c <commit> to reword the commit message
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.

##############################################
#
# xxxxxxx..yyyyyyy zzzzzzz에 리베이스(1 명령)
#
# 명령:
# p, <commit> 선택 = 커밋 사용
# r, reword <commit> = 커밋을 사용하지만 커밋 메시지를 편집합니다.
# e, edit <commit> = 커밋을 사용하지만 수정을 위해 중지
# s, squash <commit> = 커밋을 사용하지만 이전 커밋에 병합
# f, 수정 [-C | -c] <commit> = "squash"와 비슷하지만 이전 항목만 유지
# -C를 사용하지 않는 한 커밋의 로그 메시지
# 이 커밋의 메시지만 유지합니다. -c는 -C와 동일하지만
# 편집기를 엽니다.
# x, exec <command> = 쉘을 사용하여 명령(나머지 줄) 실행
# b, break = 여기서 중지(나중에 'git rebase --continue'로 계속 리베이스)
# d, drop <commit> = 커밋 제거
# l, <label> 레이블 = 현재 HEAD에 이름을 붙입니다.
# t, <label> 재설정 = HEAD를 레이블로 재설정
# m, 병합 [-C <커밋> | -c <커밋>] <레이블> [# <oneline>]
# . 원래 병합 커밋을 사용하여 병합 커밋을 만듭니다.
# . 메시지(또는 원래 병합 커밋이 없는 경우 한 줄로
# . 지정); 커밋 메시지를 다시 작성하려면 -c <commit>를 사용하십시오.
#
# 이 줄은 재정렬할 수 있습니다. 그들은 위에서 아래로 실행됩니다.
#
# 여기서 라인을 제거하면 커밋이 손실됩니다.
#
# 하지만 모두 제거하면 rebase가 중단됩니다.

+ Recent posts