Long story short*, I did some things with my git repository that I don’t know how to do, and ended up detaching my head, that is, when I commit master isn’t up to date.
How can I fix this? Do I have to merge? (If so, what are the exact commands I want to run?)
When I run git branch, it tells me I’m currently on no branch
$ git branch
* (no branch)
master
- Longer story is that I tried to undo some commits and had no idea how I was supposed to do that. I guess that wasn’t too long.
There are few ways you can end up on (no branch), but essentially its a junk branch used for examining things, e.g. old commits. If you mistakenly edited files on (no branch), you can switch back to master just as you would from any other branch with changes. Check out the help for git-checkout, but you’re going to want to do something like
git-checkout -mto move back to master and merge your current index along with it.