How to move some last Git commits currently on a branch, onto another branch?
For completeness, the answer is here - http://git-scm.com/docs/git-reset - search for the text "Undo a commit, making it a topic branch" - the example shows making the last 3 commits a branch and resetting master to the commit previous to those 3 commits:
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 3 commits.
#
nothing to commit (working directory clean)
$ git branch topic/wip
$ git reset --hard HEAD~3
$ git checkout topic/wip
Switched to branch topic/wip
git checkout master
git branch feature-Z
git reset <commit_id>
where commit_id is an identifier of that last X commit before b branches off.