Why can't I just rollback to a specific commit in git?

For this write git checkout commit what gives me type create a branch.
prntscr.com/bk847p
Found a solution.

Similar situation and solution.
Maybe someone who comes here from searching that will be useful.

Honestly to deal in the wilds of the terms "satelite", "unstage" and master the techniques of jumping through the commits did not want.

Do when you do

git checkout identificationdata
further commits turned out to be molded to it out any branches, even if you have done the checkout on your last commit (for example, I expected that returning to it, everything really back to normal).
These commits are hanging as it were in naimenovanie new branch, in a kind of meritocrat space. And of course all attempts to push the changes with

git push origin vacay
will not give you expected result. With your line all right, and with the changes too, just all the commits that were made after your manipulations with setbacks it is necessary to pour into your main branch.
The most intuitive and easy way to preimenovati current state (the current chain of commits) a new branch.

git checkout-b tempname
Then return to your home branch
git checkout vacay
and to merge changes from the branch

git merge tempname
(because in the Gita all you are is change, the branch tempname - this is only your changes, hence the intuitiveness of the method).

it only remains to remove the temporary branch, so as not to clog REP.

git branch-d tempname
And you can push.


But it shows the same thing. I want to go back to a certain place and now this. Why is this so complicated? Why can't it be done simply. Why do something to stir with branches? What is normal solution?
July 8th 19 at 12:08
3 answers
July 8th 19 at 12:10
Solution
HEAD is now at - you rolled. But if you KOMITET new changes, you will need to create a new thread in this place, where else KOMITET?
To create a branch (immediately or later before the commit), use git checkout-b

Generally worth reading it https://git-scm.com/book/ru/v1 There all is painted for beginners.
July 8th 19 at 12:12
Solution
I want to go back to a certain place and now this. Why is this so complicated?

When you went through checkout on a commit, it's just the current pointer (HEAD) has berestavitsa at that commit, but the story remained the same. Then you'll move somewhere and he just berestavitsa there. How do you remember where he was before the reshuffle? He can't remember. So it warns you that make a branch, then any permutation will lose this place.
I realized why when I created a new branch, it visually is on the same level as the mast? prntscr.com/bkeaus i.e. in addition to branch master which by default I will love to create another branch and work there? And then slivat it's all in the master? - toby commented on July 8th 19 at 12:15
:
and why when I created a new branch, it visually is on the same level as the mast?

Because when you were created, you were standing there on the master. What do you mean "was"? This means that the HEAD pointer was equal to the index master. If you go to any commit (using checkout), it will set the pointer HEAD and tell you that you are cut off from branches. But when you're standing there, create a branch, it will be created there, where there is HEAD - directly on the commit. - Ramon.Stracke commented on July 8th 19 at 12:18
: did prntscr.com/bkeiog visually on the same level is created. What did I do? - toby commented on July 8th 19 at 12:21
: so, you went to the same commit. Look at what commit you have the master pointer, and then move on to another commit and do it branch or checkout-b. - Ramon.Stracke commented on July 8th 19 at 12:24
July 8th 19 at 12:14
I also gut the gui and it's all quite simple. (Yes, Yes. Throw stones)
I also use the gui. Tell me how you can make this easier? - toby commented on July 8th 19 at 12:17
: you two have thrown stones - Ramon.Stracke commented on July 8th 19 at 12:20
: Repository - > show history for all branches - toby commented on July 8th 19 at 12:23
Stone: You're damn write code manually instead of ready-made libraries to use. But Git from the command line - not mastered. - Ramon.Stracke commented on July 8th 19 at 12:26
: This is what the message? - toby commented on July 8th 19 at 12:29
GUI convenient. The console is more powerful. For a simple, everyday actions enough huevos program. In complex cases, launch git bash.
: go to any commit is easy:
20160624-125319.png
(it's Atlassian SourceTree) - Elenor.Kilback14 commented on July 8th 19 at 12:32
: I do not exist. prntscr.com/bke3fh commit until 2. - Brody_Dickins commented on July 8th 19 at 12:35
:: try the right button click on commit. Or select in the menu search. I your not familiar, at all did not hear about this. - cletus.McLaughlin commented on July 8th 19 at 12:38

Find more questions by tags Git