Skip to content

Commit d091776

Browse files
⏮️ day 20 - restore files
1 parent 87d21dc commit d091776

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

Day 20/README.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Day 20
2+
3+
This is a combination of 2 tasks (very simple tasks) so I'm merging them both.
4+
5+
## Problem Statement:
6+
Oops - you deleted the "essay" file, which you worked on all night!
7+
8+
Luckily, Git is here to help! You can use `git checkout` to restore the file!
9+
10+
Here's a similar problem: you really liked the essay from the very first commit, and want to have it back! Well, checkout can also restore things from older commits, Here's how:
11+
```bash
12+
git checkout [commit] [file]
13+
```
14+
15+
16+
### Questions:
17+
- Restore the essay to contain "important content".
18+
- Get the first version of your essay, and make a new commit with it.
19+
20+
21+
### Files:
22+
- essay
23+
24+
25+
Restore Deleted File | Restore File from Past
26+
:-------------------------:|:-------------------------:
27+
![](https://github.com/ArnabKumarRoy02/Learn-git/assets/86621483/3952294e-57fc-4994-910d-caa01b041f74) | ![](https://github.com/ArnabKumarRoy02/Learn-git/assets/86621483/3952294e-57fc-4994-910d-caa01b041f74)
28+
29+
<div align="center">
30+
<p>Description of the problems.</p>
31+
</div>
32+
33+
## Solution:
34+
35+
1. Check out the file.
36+
```bash
37+
git checkout essay
38+
```
39+
40+
2. Checkout the file at the initial commit.
41+
```bash
42+
git checkout "SHA Code" essay
43+
```
44+
45+
3. Make a commit.
46+
```bash
47+
git commit -m "new message"
48+
```
49+
50+
Restore Deleted File | Restore File from Past
51+
:-------------------------:|:-------------------------:
52+
![](https://github.com/ArnabKumarRoy02/Learn-git/assets/86621483/3952294e-57fc-4994-910d-caa01b041f74) | ![](https://github.com/ArnabKumarRoy02/Learn-git/assets/86621483/631acb2e-3a7d-476a-8e56-9af3712143da)
53+
54+
<div align="center">
55+
<p>Description of the solutions.</p>
56+
</div>

0 commit comments

Comments
 (0)