A
A
askold20132017-08-23 19:05:24
git
askold2013, 2017-08-23 19:05:24

How to create a new branch with an old commit from master?

Hello! The question is - in the master branch there is a commit that I like more than the last one, but I don’t want to roll back to it in the master branch, but I want to create a new branch and unload this commit into it, and then work with it. however, I want both branches to be able to work in github pages. Can it be done? Well, or in one branch, but in a separate folder.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daniel, 2017-08-23
@Dyaminigo

Create a new branch from the commit you need. At the same time, it will be the last one in the new branch and all previous commits will also be saved:
Create a branch and immediately switch to it
git checkout -b branch_name hash
Create a branch without switching
git branch branch_name hash
Where hash is the commit hash you need. You can specify both its full hash, and at least the first 4 characters.
PS I haven't dealt with GitHub Pages either.

P
Pavel, 2017-08-23
@mrusklon

I haven't dealt with the github page, but isn't it worth it to make a final commit, roll back to what you like and make a new branch?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question