I was not currently on any branch when I commited my changes. I didn't really notice the message and checked out another branch.
How can I retrieve my changes? I can't merge or checkout, since there is no branch to merge from.
You can use git reflog
to get the commit hash of the commit that you did while in "no branch" ( a detached HEAD) and merge that in to the branch that you are currently in ( master maybe)
Something like git merge HEAD@{1}
You can also git rebase -i
and "pick" the commit you want from the reflog.