Firstly, how can I see which branch I am currently on? I typed “git branch” but it returned
* (no branch)
master
so then when I commit, where are these changes being committed to?
Secondly, how can I get the changes I have made onto the master branch?
When you commit something in that situation, the commit is created the same way as normally, but there is no branch pointing to it. To make it easier to find the commit afterwards (i.e. without remembering the hash or using reflog) and to protect against the garbage collector, you can create a branch to it even after committing:
After that one way of getting the changes back to master is the following, assuming that the checked out commit was a parent of master: