Skip to content

Commit 62d6df5

Browse files
📝 day 23 - reflog
1 parent 0ec2327 commit 62d6df5

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

Day 23/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Day 23
2+
3+
Today we will learn to go back on where we were before.
4+
5+
## Problem Statement:
6+
Say you were looking at something in the past, and then switched back to the main branch.
7+
8+
But then, you got really distracted, and after your lunch break, you can't remember on which commit in the past you were before. How can you find out?
9+
10+
There's a convenient command that shows you all the places your
11+
HEAD did point to in the past:
12+
`git reflog`
13+
14+
### Question:
15+
- Find out where you've been before, and go back there!
16+
17+
18+
<div align="center">
19+
<img src="https://github.com/ArnabKumarRoy02/Learn-git/assets/86621483/113f1a05-4cca-46e3-a4eb-00d49cd3eb0b" width=750>
20+
<p>Description of the problem.</p>
21+
</div>
22+
23+
## Solution:
24+
25+
1. Use the reflog command to find out the pattern.
26+
```bash
27+
git reflog
28+
```
29+
The output of the above command comes out to.
30+
```term
31+
726971f (HEAD -> main, 10) HEAD@{0}: checkout: moving from 3 to main
32+
151f810 (3) HEAD@{1}: checkout: moving from main to 3
33+
726971f (HEAD -> main, 10) HEAD@{2}: commit: 10
34+
06a8ddd (9) HEAD@{3}: commit: 9
35+
4a9b680 (8) HEAD@{4}: commit: 8
36+
0236645 (7) HEAD@{5}: commit: 7
37+
b5a3437 (6) HEAD@{6}: commit: 6
38+
7df3b91 (5) HEAD@{7}: commit: 5
39+
1113cb6 (4) HEAD@{8}: commit: 4
40+
151f810 (3) HEAD@{9}: commit: 3
41+
97c719a (2) HEAD@{10}: commit: 2
42+
374d0a3 (1) HEAD@{11}: commit (initial): 1
43+
```
44+
45+
2. From the output, you found that we need to go to the 3rd branch.
46+
```bash
47+
git checkout 3
48+
```
49+
50+
<div align="center">
51+
<img src="https://github.com/ArnabKumarRoy02/Learn-git/assets/86621483/3186f0cb-261f-4b8d-b5bf-fc3f0e2d510e" width=750>
52+
<p>Description of the solution.</p>
53+
</div>

0 commit comments

Comments
 (0)