11

This deals : How do I create a new Git branch from an old commit? about creating new branch needed from command line on a repository based on commit-id

pretty much,

git checkout -b ini_commit_ref_branch cf05eed4fbd76e30615e3876ead9ddb7c5593cd8 # eg commit
git push --set-upstream origin ini_commit_ref_branch

But how to achieve same within Github WebUi - as option of creating remote branches we get only on existing branches not from commit hash. Do we have that feature within web-ui ?.

All we see are below icons when we traverse to history of commits against selected branch in repo..

enter image description here

vinWin
  • 509
  • 1
  • 5
  • 18

1 Answers1

20

Here's how you do it.

First navigate to the commit in question, and then click on the <> button next to the commit in your history. This will show the web interface for browsing that particular commits snapshot of the repository.

Then, you see a small button with the commit id, just above the contents, like this:

enter image description here

Then, click the down arrow on this button to show the dropdown. It looks like this one allows you to browse different branches in the repository but you can actually create a new one. Simply type in the name of the new branch in the search field:

enter image description here

Then click on the "Create branch: ..." link at the bottom of this dropdown, and a new branch should be created.

Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
  • This is great!, hovering over that icon didn't displayed any option, but clicking reveled next steps by itself from UI & of-course after your answer :) – vinWin Jan 31 '20 at 14:12
  • Thanks! Couldn't have hidden this feature better myself. :) Feels like an Easter egg, really. – Sz. Apr 01 '23 at 10:47