I try to learn git. I make some mistakes in my master and only branch. I checkout to a previous commit, not the last one. I want to continue from that point. What is the correct way to do that?
Asked
Active
Viewed 80 times
0
-
1See http://stackoverflow.com/questions/4114095/revert-to-a-previous-git-commit . – Tony Barnes Jun 27 '15 at 10:21
1 Answers
0
Now that you have checked out to a previous commit, use the checkout command to create a new branch
git checkout -b newbranch
This will create a new branch from where you are right now!!

Arcanyx
- 852
- 10
- 25
-
And to make that my master I should merge newbranch master. Is that correct? – Nrc Jun 27 '15 at 10:34
-
Ah! If u wish to destroy the wrong changes, I would suggest, you go ahead with the way suggested by the @Tony Barnes in comment. But if you wish to merge it with the master both the wrong and new changes will be seen in it. So that is a no-no – Arcanyx Jun 27 '15 at 11:08