git commit 활용

test·2021년 10월 11일

git

목록 보기
8/10
post-thumbnail

git restore

  • 파일 수정 후 취소하기, staging area 취소하기, HEAD에 모든 파일 working directory로
git resotre FILENAME
git resotre --staged FILENAME
git reset HEAD .
  • 원하는 commit 으로 이동
git restore --source=HASHCODE
git restore --source=HEAD~2 FILENAME
  • commit message modify, 수정한 내용 업데이트
git commit --amend -m "NEW MESSAGE"
git commit --amend
  • 특정 커밋으로 초기화 시켜주는 명령어
git reset HEAD~1
git reset HASHCODE
git reset hard HASHCODE(완전 삭제)
git reset --mixed HASHCODE(working directory)
git reset --soft HASHCODE(staging area)
  • 실수로 commit 지웠을 때
git reflog(log 확인)
git reset --hard HASHCODE
  • commit 변경사항 삭제해주는 commit을 만듬
git revert HASHCODE
git revert HEAD~3
git revert --no-commit HASHCODE(커밋 생성 안하고 변경하기)
  • 이전 commit 업데이트 하기(HEAD 부터 지정한 commit 까지 전부 업데이트 됨)
git rebase -i(interactive) HASHCODE
  • vscode -> Local History로 언제든 원하는 파일로 이동 가능
  • IntelliJ 기본 기능으로 History 제공
profile
bedev

0개의 댓글