How to create a branch in git from an arbitrary location?

Question:

Tell me, please, is it possible to create a branch in git from a commit that is not the current one?

That is, let's say I need to work with an old version of files in a branch, how can I do this?

Answer:

git branch <branch-name> <commit-id>
Scroll to Top
AllEscort