How to "transform" a specific commit into a branch?

1

I would like to get a specific commit and turn it into a blank.

Is there any way to do this in Git ?

    
asked by anonymous 16.02.2016 / 15:04

2 answers

4

Just commit the ID at the time of creating the branch:

git checkout -b BRANCH_NAME COMMIT_ID

Example

git checkout -b teste 5d6b8da2f0e32a100087eecb73fc2dd47579748f

With this, a new "test" branch will be created based on the commit below: 5d6b8da2f0e32a100087eecb73fc2dd47579748f

    
16.02.2016 / 16:21
2

To view commits history, type:

git log

After that, just get the commit ID you want:

git commit -b nomebranch 7e85bcb18b1fcf58738f3ec6a2e04171975ef442

Or:

git checkout 7e85bcb18b1fcf58738f3ec6a2e04171975ef442
git checkout -b nomebranch
    
16.02.2016 / 16:24