반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- CUDA
- opencv
- string
- ChatGPT
- 터미널
- no space left on device
- TTS
- 티스토리챌린지
- tensorflow
- Android
- pytorch
- timm
- ubuntu
- CLASS
- GPT
- error
- ros
- 스팸
- linux
- 맛집
- openAI
- 오블완
- Torch
- 딥러닝
- python
- socketio
- 판교
- ROS2
- 분당맛집
- humble
Archives
- Today
- Total
RoBoLoG
[Git] commit 시점으로 파일 되돌리기 본문
Git으로 작업하다가 push 이후 갑자기 파일이 날아갔을 때 당황하지 말자
1. commit 로그 확인
터미널에 다음과 같이 입력하여 commit 로그를 확인한다.
git reflog
그러면 commit 로그를 확인할 수 있으며, 맨 앞에 숫자/알파벳 배열은 commit id이다.
1f924e9 (HEAD -> devel, origin/devel) HEAD@{0}: commit: display and expression
8180870 (master) HEAD@{1}: reset: moving to 8180870
f7ce8ed HEAD@{2}: checkout: moving from devel to devel
f7ce8ed HEAD@{3}: checkout: moving from master to devel
8180870 (master) HEAD@{4}: commit: display and expression recognition added
5c1cc32 HEAD@{5}: commit: identification added
dfb2531 HEAD@{6}: commit: identification added
f7ce8ed HEAD@{7}: commit (initial): Initial commit
여기서 commit_id가 8108870인 시점으로 되돌아가도록 하겠다.
2. commit 시점으로 되돌아가기
git reset을 이용하여 commit 시점으로 되돌아간다.
commit_id에 8108870을 넣어주면 해당 시점으로 되돌아가진다.
git reset --hard commit_id
728x90
반응형