young
is this it
young
전체 방문자
오늘
어제
  • 분류 전체보기 (143)
    • 웹_프론트엔드 (1)
      • 로드맵 챌린지 (73)
      • Svelte (2)
      • React (6)
      • JavaScript (8)
      • TypeScript (2)
      • HTML+CSS (5)
    • 웹_백엔드 (0)
      • Django (0)
    • 빅데이터 (33)
      • R (30)
      • Python (2)
    • 기타 (11)
      • git (3)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • form
  • 공개키
  • vcs
  • 암호화
  • bem
  • ssl
  • 구글맵api
  • css네이밍
  • Regex
  • ggplot
  • 대칭키
  • owasp
  • 태스크러너
  • 버전관리
  • rstudio지도정보
  • css후처리기
  • 인증
  • 웹보안
  • ggmap()
  • 보안취약점

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
young

is this it

기타/git

[git] 커밋 메시지 수정하기

2023. 4. 18. 11:14
반응형

1. push 전 ( 커밋이 로컬에 있을 때 )

1) 가장 최근 커밋 메시지 수정하기

git commit --amend

 

2) 최근이 아닌 커밋 메시지 수정

// 깃 로그부터 확인
git log

// 위에서 3번째 커밋 선택
git rebase -i HEAD~3

// 이후 아래처럼 뜨면, 수정할 커밋들을 "pick"에서 "reword"로 바꾼 후 순서대로 수정
pick e499d89 Delete CNAME
pick 0c39034 Better README
pick f7fde4a Change the commit message but push the same commit.

# Rebase 9fdb3bd..f7fde4a onto 9fdb3bd
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# 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.
#
# Note that empty commits are commented out

 

2. push 후 ( 커밋이 remote에 올라간 상태 )

이때는 force로 수정된 커밋을 강제로 push 해야 한다. force pushing은 push된 커밋의 로그를 다른 팀원들이 수동으로 수정해야 하기때문에 최대한 지양해야 한다.

git push --force 브랜치이름
반응형

'기타 > git' 카테고리의 다른 글

[git] 깃 명령별(pull, merge, commit, add) 취소하고 되돌리기  (0) 2024.03.17
깃허브에 있는 파일 또는 디렉토리 삭제하는 방법  (0) 2022.09.19
    '기타/git' 카테고리의 다른 글
    • [git] 깃 명령별(pull, merge, commit, add) 취소하고 되돌리기
    • 깃허브에 있는 파일 또는 디렉토리 삭제하는 방법
    young
    young

    티스토리툴바