Vaccano
Vaccano

Reputation: 82341

Create a branch in Git at a specific point in time

We have identified an issue in our production code. But several merges to Master have happened since the release. No tag or branch was made at the time of release. But we know when the release build started.

When I used TFS, I could just pick a point in time and create a branch from that point.

How can I do that in Git?

Upvotes: 3

Views: 1900

Answers (1)

SwissCodeMen
SwissCodeMen

Reputation: 4885

Find your commit where you want to create a new branch:

git log

With this commit-id you can create a branch with the version of this commit-id:

git branch <branch-name> <commit-id>


You can also use

git checkout <commit-id>

that will bring you to the version of this commit-id, after this create a branch with

git branch <branch-name>

and then go to this created branch (checkout)

git checkout <branch-name>

This two steps, can be done in one:

git checkout -b <branch-name>

Upvotes: 8

Related Questions