Home git Back to the desired commit

Back to the desired commit [Duplicate]

Author

Date

Category

I have a project, I made changes to it and now it is not compiled. I want to roll back to the comite I need. In other words, I need to change in my files on the PC, came to the sight as I needed a commence. How to do it?

Git Log:

Commit B7521fb90a8225a4f96a591c596556bd180132f1
Author: Sonyaimbo & LT; ****** @ gmail.com & gt;
Date: Thu Sep 15 13:55:25 2016 +0300
  Added upload GCC 4.9
COMMIT 53D1BB31B554D1422661E4F4A71F7582E31Fea4.
Author: Sonyaimbo & LT; ****** @ gmail.com & gt;
Date: Thu Sep 15 03:16:43 2016 +0300
  Included Gentle Fair Sleepers
Commit 2B1535103118C52FF80199D1C688966BD783D1B3.
Author: Sonyaimbo & LT; ****** @ gmail.com & gt;
Date: Thu sep 15 01:25:12 2016 +0300
  Small edits in the config

I need to roll back to this 53D1BB31B554D1422661E4F4A71F7582E31FEA4 Committee.

here My commits, with this I want to remove the commits since this .


Answer 1, Authority 100%

Git Reset --hard head ~ 1

Removes with the ends, applies with some very large shoals. Judging by the story just at 1 Commit.

git checkout 53d1bb31b554d1422661e4f4a71f77582e31fea4

just gently moves to this commit.


Answer 2

Simply delete the Commit can not. That is, it is possible, but then all the subsequent commits will be rebuilt. Therefore, the REVERT technology is used – that is, rolling “commit on the contrary”. This is done in the console by the Git Revert & Lt; Sha Hesh Committed & GT; . If you need to roll back several commits – apply sequentially.

Yes, in the story there will be a “comment rollback of such”. But this is normal.

Conflicts are possible when rolling Commit. They will need to decide.

In your question you write “roll back to Commit” and “Delete Commitments”. Decide 🙂

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions