Revert

  • 해당 커밋의 변경 사항으로 되돌림
    • git revert <commit hash>
  • 여러 커밋 한 번에 돌리기
    • git revert <시작 커밋 해시>..<끝 커밋 해시>
  • 중간에 충돌 발생 시, 해결하고 파일 추가하고 계속 진행
      git add <파일명>
      git revert --continue
  • revert 작업 중단
    • git revert --abort

Reset

  • Git에서 특정 커밋 시점으로 브랜치를 이동시키는 명령어
  • reset --soft <commit hash> : 히스토리 유지 및 변경 사항 스테이지 상태로 되돌림
    • 스테이지 상태의 변경사항을 재수정해서 commit 시, 새로운 commit으로 판단하여 충돌 x
  • reset --mixed <commit hash> : 히스토리 유지 및 변경 사항은 제거
  • reset --hard <commit hash> : 히스토리 및 변경 사항 제거

Create bracnh from commit 이용

  • Revert가 안될 떄, 해결방안으로 사용 가능
  • 해당 commit 시점으로 새로 branch를 팔 수 있음
      git checkout abc123
      git checkout -b feature/new-branch

'프레임워크 > Git' 카테고리의 다른 글

Git PR 전에 하면 좋은 사항  (1) 2025.03.22
GPG key 등록  (0) 2025.03.22

+ Recent posts

let textNodes = document.querySelectorAll("div.tt_article_useless_p_margin.contents_style > *:not(figure):not(pre)"); textNodes.forEach(function(a) { a.innerHTML = a.innerHTML.replace(/`(.*?)`/g, '$1'); });