From the course: Git Essential Training
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Delete files
- [Instructor] We've already added files and made changes to existing ones, but what happens if we delete a file? Let's find out. Let's go back to our repository. I am going to delete Example02.md. I'll press Delete and confirm that I want to delete it. Let's use git status to see how Git responds to this. It shows that the file has been deleted. If we want this change to follow through into the Git repository, we have to commit it like we would with any other changes. So, I'll stage it using git add . and then commit it with a message like Removes Example02.md. Git now shows that one file was changed and everything inside it was deleted. Now, let's push. And now, I can check my remote repository. When I refresh it, I see that Example02 has been deleted as well. I can still see the commit message though, and that's the important part. Even though the file has been deleted, Git still remembers it. It is still part of those old snapshots in the Git history. This means it's possible to…
Contents
-
-
-
-
-
-
-
(Locked)
Git status2m 24s
-
(Locked)
Edit a file and view changes4m 14s
-
(Locked)
Delete files1m 35s
-
(Locked)
Rename files2m 18s
-
(Locked)
Working with folders3m 5s
-
(Locked)
Undo your changes2m 20s
-
(Locked)
View commit history4m 5s
-
(Locked)
Go back in Git history1m 52s
-
(Locked)
Revert a commit1m 55s
-
(Locked)
Make use of the GUI of Visual Studio Code2m 51s
-
(Locked)
Challenge: Make a change and revert51s
-
(Locked)
Solution: Make a change and revert2m 22s
-
(Locked)
-
-