R
R
Roman2019-10-14 09:39:28
git
Roman, 2019-10-14 09:39:28

How do I make the current (master) local branch a spare branch, go back a few commits (to commit-23) and start a new master from there?

1. Git is local.
2. I write commits in master.
3. Now I realized that I want to roll back (say, to commit-23) and start over from it.
4. But I also want to keep the current development in reserve.
How can I do this?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2019-10-14
@procode

git branch -mrename branch master
git checkout -b master <с какого коммита>checkout from desired commit to new branch

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question