뭐든 즐기면서 ;)

Git 특정 head / Git commit history 본문

IT정리/Git Hub

Git 특정 head / Git commit history

Tada.*+ 2022. 11. 17. 14:32
728x90

Git 특정 commit 상태로 돌아가는 방법

  • git log 명령어로 commit head hash값을 알아냅니다.
> git log
commit commit_head_hash값
Author: commit한 사용자
Date:   commit한 날짜

    commit메세지 내용

commit 62211dad7db3f3f86fbf088e5b13d1ade6e6ebde
Author: bhr0554
Date:   Wed Oct 26 14:26:25 2022 +0900

    commit메세지 내용

commit 5bce03b24c188aed5e8acaa2c457c73d7bc2c0b0
Merge: b7ff1fe3 72c13842
Author: bhr0554
Date:   Thu Oct 20 14:26:46 2022 +0900

    commit메세지 내용
  • git checkout 명령어로 해당 commit상태로 돌아갑니다.
# git checkout [commit_head_hash값]
> git checkout 62211dad7db3f3f86fbf088e5b13d1ade6e6ebde
  • 본래 상태로 돌아가기 위해서는 commit hash값을 입력하여도 되고, 브랜치명을 입력해도 됩니다.
# git checkout [브랜치명 또는 hash값]
> git checkout master

 

728x90

'IT정리 > Git Hub' 카테고리의 다른 글

[Git] gitignore 적용하기  (0) 2024.01.22
Git rebase - git history에 대해 알아보기  (0) 2023.01.17
Git merge - git history에 대해 알아보기  (0) 2023.01.14
Git stash 명령어  (0) 2021.11.20
Comments