So I am using git and github. I made some poor commits and pushed them to github. I then reverted back to the most recent good commit, and started working from that branch. I did this using a command like
git checkout last_good_commit_hash
I checked out to a commit, not to a branch that I had made myself.
I then changed a lot of code, added a lot of good commits, and decided it was time to push to github. However, the github repo was already up to date, because the master branch is not my current branch.
When I run git branch
I get this output:
* (detached from 0c42801)
master
I'd love to use a git command like the one from this stackoverflow question
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge better_branch # fast-forward master up to the merge
However, I don't know the name of the better branch, because it seems to be named (detached from 0c42801)
How can I get my correct branch to become the master/head and push it to github?