title: How to create branch from several commits back?
body: <p>I'm fairly new to git. </p>
  
  <p>Currently I have the commits depicted below, which have been pushed to remote. 
  <a href="https://i.stack.imgur.com/TMP3N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TMP3N.png" alt="only 1 branch"></a></p>
  
  <p>I created a branch (branch1) when I had to start building a ui.
  But I realized that I should have made a second branch when I worked on another feature (in green). </p>
  
  <p>How do I get from my current setup to the following setup? If it makes things easier, I'm working on with no other collaborators.</p>
  
  <p><a href="https://i.stack.imgur.com/raqhn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/raqhn.png" alt="separate branches"></a></p>
  
  <p>Update:
  All the answers worked, I accepted the first one that was submitted, but used a combination of the answers. To undo commits , we can use the interactive rebase tool (<a href="https://stackoverflow.com/questions/18655170/deleting-a-commit-in-between-other-commits">Deleting a commit in Between other commits</a>).</p>