A
A
alexsuhor2022-03-12 06:34:13
git
alexsuhor, 2022-03-12 06:34:13

How to rollback commits in git?

I am new to git. Yes, and in development in general. I'm taking a video course on django. In the course of the course, I create a site, completely repeating after the teacher, while making commits in certain places. I make several commits in one lesson. Obviously, only by repeating exactly the same, it is difficult to learn something. Therefore, after watching the video, I want to roll back the last few commits and write all the code myself. The question is how to do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Kuznetsov, 2022-03-12
@alexsuhor

Roll back three commits:
git reset --hard HEAD~3
In general, you should not blindly repeat commands. It is better to read the documentation and work meaningfully.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question