I checked out the commit right before my most recent commit, made some changes, and now I want to overwrite/merge the code I currently have (edited version of "Refined zoom...") with the most recent commit ("Added call API..."). However, Android studio will not allow me to push, because the head is detached. What and I do to fix this? Do I create a new branch and attempt to merge? Delete the latest commit and then try to push? Any help is appreciated.
Even in basic git (command line or such) if you try to do a pull on a detached head it will complain - this is because it does not really know what to do with the merge (you have no branch).
So, as you suggest, the simplest (IMHO) approach is to create some branch and then merge whatever you need in it (I don't know anything about Android studio so I'll give example in git command line).
These are the basic steps which apply to branching in general:
git branch new_branch
git checkout new_branch
git commit -am "my changes"
(you may need to add any new files first with git add ...
).git merge <some commit hash, branch-name, or tag>
git push origin new_branch