Buat Branch dari Commit GIT

Tampil 03/July/2020

Bismillah

Lagi iseng mau nyamain kode berdasarkan commit ... jadi tidak usah rollback atau liat digithub, cukup dilocal komputer kita juga bisa, ini dia tricknya:

$ git checkout <commit>
$ git checkout -b feature    # create a new branch named `feature` from the commit

# if you want to replace the current branch (say 'develop') with new created branch ('feature')
$ git branch -D develop     # delete the local 'develop' branch
$ git checkout -b develop   # create a new 'develop' branch from 'feature' branch

Done.

Sumber: https://stackoverflow.com/a/42159757