git tricks vol. 1
Question: I have branched off master to work on a feature, and I have 3 commits made on the feature. However I have gone off into the weeds on my feature. I want to save my work, but I also want to go back to the first commit on my feature, and start a new branch to test an idea. Can I do this?
starting point:
   commit1----commit2----commit3  [feature]
  /
commitA----commitB [master]Answer: this is Git, of course you can.
# create the branch
git branch <new-branch> <commit-SHA-where-you-want-to-branch-from>
# create and checkout
git checkout -b <new-branch> <commit-SHA-where-you-want-to-branch-from>new git status:
     commitZ  [new-branch]
    /
   commit1----commit2----commit3  [feature]
  /
commitA----commitB [master]Cool.