I'm pretty new to Git so I was playing around with it before I knew what workflow and structure I wanted to use for my development repository. I created a local repository that I wanted to use to replace a remote one. I am currently the only one using it (though I cloned on different machines).
Basically, I created a new local repository and got it the way I wanted it. I forced a push to the remote repository to overwrite the old one like stated here: How can I choose to overwrite remote repository with local commits? ... well except that I used the URL instead of origin.
Then I added the remote repository and checked to see if it worked.
$ git remote add origin <url>
I looked at the full history and I ended up with something like this:
Oh no! So I removed the remote and no change. Now I have this detached history AND branches that don't exist. So then I tried this: How do you remove an invalid remote branch reference from Git?
It didn't help.
$ git remote show
Shows up empty. Is there any way to undo this? I don't see how just adding a remote could muck up my working directory this badly!
Edit: I just noticed that there is one branch on the old history that wasn't the same as a new one. Also, I did fetch after adding the remote repository. I can see the old branch in
$ git reflog --all
and it shows up as
16903f4 refs/remotes/origin/feature/test-feature@{0}: fetch origin: storing head